Skip to content

Instantly share code, notes, and snippets.

@billerickson
billerickson / gist:1325314
Created October 30, 2011 00:54
Add rel=nofollow to categories
<?php
/**
* Add rel=nofollow to wp_list_categories
* @link http://www.billerickson.net/adding-nofollow-to-category-links/
* @author Bill Erickson
*/
function add_nofollow( $text ) {
$text = stripslashes($text);
$text = preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);
@billerickson
billerickson / gist:1325318
Created October 30, 2011 00:57
Custom Post Type
<?php
/**
* Create Rotator post type
*
* @link http://codex.wordpress.org/Function_Reference/register_post_type
*
*/
function be_register_ebook_post_type() {
@billerickson
billerickson / gist:1325325
Created October 30, 2011 01:06
Youtube embed code with transparency
<object width="340" height="206">
<param name="movie" value="http://www.youtube.com/v/LV2imPhUdMw&hl=en_US&fs=1&"></param>
<param name="wmode" value="transparent" />
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/LV2imPhUdMw&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="340"
height="206" wmode="transparent"></embed>
</object>
@billerickson
billerickson / gist:1325327
Created October 30, 2011 01:13
Add Transparency to oEmbed videos
<?php
/**
* Add Transparency to oEmbed videos
*
* @link http://www.billerickson.net/wordpress-video-menu-hidden-fix/
* @author Bill Erickson
* @param string $video embed code
* @return string modified embed code
*/
@billerickson
billerickson / gist:1325380
Created October 30, 2011 02:20
Facebook Like - Thesis
<?php
/**
* Facebook Like on Single Posts - Thesis
*
*/
function facebook_like_single() {
if( is_single() )
echo '<iframe src="http://www.facebook.com/plugins/like.php?href=' . get_permalink() . '&amp;layout=button_count&amp;show_faces=true&amp;width=250&amp;height=20px
@billerickson
billerickson / gist:1325454
Created October 30, 2011 03:59
Facebook Like on Genesis
<?php
/**
* Facebook Like on Single Posts - Genesis
*
*/
function facebook_like_single() {
if( is_single() )
echo '<iframe src="http://www.facebook.com/plugins/like.php?href=' . get_permalink() . '&amp;layout=button_count&amp;show_faces=true&amp;width=250&amp;height=20px
@billerickson
billerickson / gist:1325461
Created October 30, 2011 04:03
Ad Shortcode
<?php
/**
* Ad Shortcode
* @link http://www.billerickson.net/using-shortcodes/
* @author Bill Erickson
*
* @return string ad
*/
function be_ad_shortcode() {
@billerickson
billerickson / gist:1325467
Created October 30, 2011 04:09
Button Shortcode
<?php
/**
* Button Shortcode
* @link http://www.billerickson.net/using-shortcodes/
* @author Bill Erickson
*
* @param array attributes
* @param string button text
* @return string button
@billerickson
billerickson / gist:1325474
Created October 30, 2011 04:18
Create Price Range Taxonomy
<?php
/**
* Create Price Range Taxonomy
* @author Bill Erickson
* @link http://www.billerickson.net/wordpress-custom-taxonomies/
*
*/
function be_register_price_range_taxonomy() {
@billerickson
billerickson / gist:1325476
Created October 30, 2011 04:21
Display terms
<?php the_terms( $post->ID, 'frameworks', '<p>Framework: ', ', ', '</p>' ); ?>