Skip to content

Instantly share code, notes, and snippets.

Avatar

Bill Erickson billerickson

View GitHub Profile
@billerickson
billerickson / ImageOverride
Created Aug 23, 2011
Allows you to override WordPress' auto-generated images
View ImageOverride
<?php
/*
Plugin Name: Image Override
Plugin URI: http://www.billerickson.net
Description: Allows you to override image sizes
Version: 1.0
Author: Bill Erickson
Author URI: http://www.billerickson.net
License: GPLv2
*/
@billerickson
billerickson / display_posts_shortcode_output.php
Created Aug 27, 2011
Add Facebook Like to Display Posts Shortcode plugin
View display_posts_shortcode_output.php
<?php
/**
* Add Facebook Button to Display Posts Shortcode plugin
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://wordpress.org/support/topic/facebook-likeshare-button-at-the-end-of-excerpt
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
* @param $image string, the image part of the output
@billerickson
billerickson / gist:1179950
Created Aug 30, 2011
Shorten excerpt in display posts shortcode
View gist:1179950
<?php
/**
* Shorten excerpt in display posts shortcode
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://www.billerickson.net/shortcode-to-display-posts/comment-page-1/#comment-4508
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
View gist:1193447
<?php
/**
* Template Redirect
* Use archive-event.php for all events and 'event-category' taxonomy archives.
* Use archive-business.php for all businesses and 'business-category' taxonomy archives.
*
*/
function be_template_redirect( $template ) {
if ( is_tax( 'event-category' ) ) $template = get_query_template( 'archive-event' );
if ( is_tax( 'business-category' ) ) $template = get_query_template( 'archive-business' );
@billerickson
billerickson / gist:1196287
Created Sep 6, 2011
Remove Metaboxes from Genesis Theme Settings
View gist:1196287
<?php
/**
* Remove Metaboxes
* This removes unused or unneeded metaboxes from Genesis > Theme Settings.
* See /genesis/lib/admin/theme-settings for all metaboxes.
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/remove-metaboxes-from-genesis-theme-settings/
*/
@billerickson
billerickson / gist:1204283
Created Sep 8, 2011
Limit metabox to specific page
View gist:1204283
<?php
// Changes to metabox array, new field 'show_on'
$meta_boxes[] = array(
'id' => 'blog-options',
'title' => 'Blog Options',
'pages' => array('page'),
'show_on' => array( 'key' => 'id', 'value' => array( 12 ) ),
'context' => 'normal',
'priority' => 'low',
@billerickson
billerickson / gist:1207505
Created Sep 9, 2011
Determine which type of prev/next post navigation to display based on source
View gist:1207505
<?php
/**
* functions.php
*
*/
// Use single template file for Design Gallery archive and Taxonomy
add_filter('template_include', 'be_design_gallery_template', 1, 1);
@billerickson
billerickson / gist:1209601
Created Sep 11, 2011
Add custom fields to Display Posts Shortcode
View gist:1209601
<?php
/**
* Add custom fields to Display Posts Shortcode
* @author Bill Erickson
* @link http://wordpress.org/extend/plugins/display-posts-shortcode/
* @link http://www.billerickson.net/shortcode-to-display-posts/comment-page-1/#comment-4565
*
* @param $output string, the original markup for an individual post
* @param $atts array, all the attributes passed to the shortcode
* @param $image string, the image part of the output
@billerickson
billerickson / gist:1212577
Created Sep 12, 2011
Change posts per page for post type
View gist:1212577
<?php
/**
* Change 'products' posts per page on archive
* This is the long version that explains everything
*/
function be_modify_products_query_long ( $query ) {
// Check to make sure we're modifying the main query
global $wp_the_query;
if( $wp_the_query !== $query )
@billerickson
billerickson / gist:1222768
Created Sep 16, 2011
Patch to add custom post type support to CMS Page Order plugin
View gist:1222768
Index: cms-page-order.php
===================================================================
--- cms-page-order.php (revision 439171)
+++ cms-page-order.php (working copy)
@@ -36,8 +36,11 @@
/** Setup Page, Styles and Scripts */
function cmspo_admin_menu() {
load_plugin_textdomain( 'cms-page-order', false, '/cms-page-order/locale/');
- $page = add_submenu_page( 'edit.php?post_type=page', __( 'Page Order', 'cms-page-order' ), __( 'Page Order', 'cms-page-order' ), 'edit_pages', 'order', 'cmspo_menu_order_page' );
- add_action( 'admin_print_styles-' . $page, 'cmspo_print_styles' );
You can’t perform that action at this time.