Skip to content

Instantly share code, notes, and snippets.

View senlin's full-sized avatar

Pieter Bos senlin

View GitHub Profile
@senlin
senlin / icons-social.php
Created October 29, 2011 15:21
Add Facebook, Twitter, Google+ and LinkedIn sharing to your template files with this easy to adapt tempate-part
<?php /*
Name: Social Media Icons Template Part
Description: Add Facebook, Twitter, Google+ and LinkedIn sharing to your template files with this easy to adapt tempate-part
Author: Piet Bos
Author URI: http://wpti.ps
Instructions: Step 1. Take the code from line 10-36 of this file, paste them into a blank file, save that file as icons-social.php and upload it to your theme's directory. On lines 19 and 21 you need to fill in your Twitter username and on line 24 you need to upload your favourite tweet-button (or grab it from http://a2.twimg.com/a/1319826270/images/goodies/tweetn.png) to the images folder of your theme. Step 2. Take line 39 of this file and paste it into your template files on the place where you want the icons to show up. Step 3. Take the scripts of line 42-49 and paste them in your footer.php file just above the closing </body> tag. Step 4. Style through CSS. NOTE that with the code below you will get 4 working share buttons. If you however want to make adjustments then visit the following pa
@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 / 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'