Skip to content

Instantly share code, notes, and snippets.

View senlin's full-sized avatar

Pieter Bos senlin

View GitHub Profile
@senlin
senlin / slippry-slider-sample.php
Created April 8, 2014 13:37
sample to build slider with featured image with slippry
<?php
/**
* The following code is a copy of the code I recently used on the site of a client
* It uses the Aqua-Resizer script (https://github.com/syamilmj/Aqua-Resizer) to
* dynamically resize the slider images to the size needed.
*
* @source Piet Bos http://senlinonline.com
*/
echo '<div class="slider-wrapper">';
@senlin
senlin / custom_walker.php
Created June 5, 2014 05:28
Custom Walker of Flatbook theme that adds # in front of menu items to enable one-page website
<?php
/**
* Custom Walker used in Flatbook theme
*
* @source //themeforest.net/item/flatbook-flat-ebook-selling-wordpress-theme/6023410
* @ref //lnkd.in/dRjx4R6
*/
class description_walker extends Walker_Nav_Menu{
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0){
//global $wp_query;
@senlin
senlin / add-4th-image-different-size-to-query.php
Last active August 29, 2015 14:03
add 4th image different size to query; LinkedIn post http://lnkd.in/dbxp28Z
<?php
/**
* add 4th image different size to query; LinkedIn post http://lnkd.in/dbxp28Z
*
*/
/* Cleaner to write arguments separately; 'order_by' => 'date' is not necessary as that is the default */
$args = array(
'post_type' => 'post',
'category_name' => 'uitgelicht',
<?php
/**
* Gravity Wiz // Require Minimum Character Limit for Gravity Forms
*
* Adds support for requiring a minimum number of characters for text-based Gravity Form fields.
*
* @version 1.0
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@senlin
senlin / wpml-config.xml
Created August 2, 2014 01:42
WPML configuration file for the TOC+ WordPress plugin. The plugin comes with 5 variables in the Settings that cannot be translated. If you are running a multilingual website with WPML just add this file to the root of the plugin and you will see the 5 strings show up in the String Translations
<wpml-config>
<admin-texts>
<key name="toc-options">
<key name="heading_text" />
<key name="visibility_show" />
<key name="visibility_hide" />
<key name="sitemap_pages" />
<key name="sitemap_categories" />
</key>
</admin-texts>
@senlin
senlin / sButton.php
Last active August 29, 2015 14:19
Issue with WordPress shortcodes When I insert '[button]Button text[/button]' into a page, automatically <br /> tags comes before and after it, but I do not want that to happen. OP: https://www.linkedin.com/groups/Issue-WordPress-shortcodes-3722491.S.5993861951699058688
<?php
function sButton( $atts, $content = null ) {
extract(shortcode_atts(
array(
'link' => '#',
'grootte' => 'klein',
'id' => '1',
'randen' => ''
), $atts )
);
<?php
/**
* Adding Custom post type counts in 'Right now' Dashboard widget.
* Acording this changes :
* - https://core.trac.wordpress.org/ticket/26571
* - https://core.trac.wordpress.org/ticket/26495
* now you can't use 'right_now_*' action API to show your custom post type count from your Dashboard.
* But if you running WP 3.8 or above, you can use 'dashboard_glance_items' instead.
*
* @package Wordpress
@senlin
senlin / gist:1079895
Created July 13, 2011 07:45
show uploaded images on single-customposttype.php file
// use this only for the metabox script of Rilwis - http://www.deluxeblogtips.com/p/meta-box-script-for-wordpress.html#images
// the code below shows the image with a link to itself (to be used on thickbox overlays)
global $wpdb;
$meta = get_post_meta(get_the_ID(), 'sl_screenshots', false);
$meta = implode(',', $meta);
$images = $wpdb->get_col("
SELECT ID FROM $wpdb->posts
WHERE post_type = 'attachment'
@senlin
senlin / search-to-nav.php
Created October 2, 2011 23:48
add search box to navigation bar
<?php
// ADD SEARCH BOX TO NAVIGATION
function add_search_box($items, $args) {
ob_start();
get_search_form();
$searchform = ob_get_contents();
ob_end_clean();
$items .= '<li class="nav_search">' . $searchform . '</li>';
return $items;
}
@senlin
senlin / add-breadcrumb-navigation.php
Created March 15, 2012 17:54
Add Breadcrumb Navigation
<?php // Add Breadcrumb Navigation
function write_breadcrumb() {
$pid = $post->ID;
$trail = '<a href="/">'. __('Home', 'textdomain') .'</a>';
if (is_front_page()) {
// do nothing
}
elseif (is_page()) {
$bcarray = array();