Skip to content

Instantly share code, notes, and snippets.

Bill Erickson billerickson

Block or report user

Report or block billerickson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@billerickson
billerickson / gist:1229106
Created Sep 20, 2011
Facebook Like on Genesis
View gist:1229106
//** This goes in the setup function **//
// Remove the default doctype and build our own
remove_action( 'genesis_doctype', 'genesis_do_doctype' );
add_action( 'genesis_doctype', 'be_do_doctype' );
// Add facebook's meta tags
add_action( 'wp_head', 'be_facebook_meta' );
View gist:1229367
<?php
//** Website: http://links.billerickson.net/
//** In functions.php: **//
// Find URL in post
function be_find_url( $content ) {
preg_match( '|href=["]([^\'^"]+)["]|mi', $content, $m );
return $m[1];
}
@billerickson
billerickson / gist:1235232
Created Sep 22, 2011
Limit metabox by page template
View gist:1235232
Limit Metabox by Page Template
To test, go into init.php and replace the add() function with the one below. Then, add the following to a metabox array:
'show_on' => array( 'key' => 'page-template', 'value' => 'template-name.php' ),
Of course, replacing template-name.php with your template's file name.
<?php
// Add metaboxes
@billerickson
billerickson / gist:1238189
Created Sep 23, 2011
Exclude Category 4 from Blog
View gist:1238189
<?php
add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );
/**
* Exclude Category from Blog
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
@billerickson
billerickson / gist:1238202
Last active Mar 28, 2019
Exclude Category from Blog
View gist:1238202
<?php
add_action( 'pre_get_posts', 'be_exclude_category_from_blog' );
/**
* Exclude Category from Blog
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
@billerickson
billerickson / gist:1238229
Created Sep 23, 2011
Change Posts Per Page for Event Archive
View gist:1238229
<?php
add_action( 'pre_get_posts', 'be_change_event_posts_per_page' );
/**
* Change Posts Per Page for Event Archive
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
@billerickson
billerickson / gist:1238281
Last active Mar 28, 2019
Customize Event Query using Post Meta
View gist:1238281
<?php
/**
* Customize Event Query using Post Meta
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
@billerickson
billerickson / gist:1243250
Created Sep 26, 2011
Photo Credit Fields in Media Gallery
View gist:1243250
<?php
/**
* Add Photographer Name and URL fields to media uploader
*
* @param $form_fields array, fields to include in attachment form
* @param $post object, attachment record in database
* @return $form_fields, modified form fields
*/
@billerickson
billerickson / gist:1243276
Created Sep 26, 2011
Include In Rotator option in Media Uploader
View gist:1243276
<?php
/**
* Add "Include in Rotator" option to media uploader
* Limited to Home page
*
* @param $form_fields array, fields to include in attachment form
* @param $post object, attachment record in database
* @return $form_fields, modified form fields
@billerickson
billerickson / gist:1243289
Created Sep 26, 2011
Get images marked "Include in Rotator"
View gist:1243289
<?php
// Get all images attached to post that have "Include in Rotator" marked as "Yes"
global $post;
$args = array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_status' => 'inherit',
'posts_per_page' => '-1',
You can’t perform that action at this time.