Skip to content

Instantly share code, notes, and snippets.

@billerickson
billerickson / ImageOverride
Created August 23, 2011 16:09
Allows you to override WordPress' auto-generated images
<?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 August 27, 2011 16:35
Add Facebook Like to Display Posts Shortcode plugin
<?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 August 30, 2011 01:50
Shorten excerpt in display posts shortcode
<?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
<?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 September 6, 2011 00:59
Remove Metaboxes from Genesis Theme Settings
<?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 September 8, 2011 18:50
Limit metabox to specific page
<?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 September 9, 2011 22:38
Determine which type of prev/next post navigation to display based on source
<?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 September 11, 2011 13:46
Add custom fields to Display Posts Shortcode
<?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 September 12, 2011 21:53
Change posts per page for post type
<?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 September 16, 2011 18:37
Patch to add custom post type support to CMS Page Order plugin
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' );