Skip to content

Instantly share code, notes, and snippets.

View bhwebworks's full-sized avatar

John Sundberg bhwebworks

View GitHub Profile
@bhwebworks
bhwebworks / gist:1696474
Created January 29, 2012 00:47
Add the category option to the widget's form
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?>: </label>
<input type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
</p>
<p><!-- this adds the category option to the widget's form -->
<label for="<?php echo $this->get_field_id('category'); ?>"><?php _e('Category ID','dbem'); ?>: </label>
<input type="text" id="<?php echo $this->get_field_id('category'); ?>" name="<?php echo $this->get_field_name('category'); ?>" size="3" value="<?php echo $instance['category']; ?>" /><br />
<label for="<?php echo $this->get_field_id('category'); ?>"><?php _e('(separate multiple IDs by commas, or use "0" for all categories)','dbem'); ?> </label>
</p>
<p>
@bhwebworks
bhwebworks / gist:1696410
Last active September 30, 2015 00:58
VideoPress embed code trimmed down and used as image link
<div style="text-align: center;">
<a href="http://s0.videopress.com/player.swf?guid=U0t5LnWv&amp;v=1.03"
data-lightbox="width:640;height:480">
<img title="Seasons screenshot" src="http://blackhillswebworks.com/wp-content/uploads/2012/01/seasons-screenshot.jpg"
alt="Seasons screenshot" width="400" height="286" />
</a>
</div>
@bhwebworks
bhwebworks / gist:1696423
Last active September 30, 2015 00:58
VideoPress shortcode combined with the Widgetkit Lightbox
<div style="text-align: center;">
<a title="Seasons" href="#U0t5LnWv" data-lightbox="">
<img title="Seasons" src="http://blackhillswebworks.com/wp-content/uploads/2012/01/seasons-screenshot.jpg"
alt="Seasons screenshot" width="400" height="286" />
</a>
</div>
<div style="display: none;">
<div id="U0t5LnWv" style="width: 633px; height: 475px; overflow: hidden;">
[wpvideo U0t5LnWv w=633 h=475]
@bhwebworks
bhwebworks / gist:1696789
Created January 29, 2012 02:14
Limit the number of post revisions
/** Added the following to limit the number of post revisions */
define('WP_POST_REVISIONS', 3);
@bhwebworks
bhwebworks / gist:1696466
Created January 29, 2012 00:44
Add 'category' to the widget's function
'scope' => 'future',
'category' => 0, // this adds 'category' to the widget's function
'order' => 'ASC',
@bhwebworks
bhwebworks / gist:1696481
Created January 29, 2012 00:50
Add to events-manager.php
include_once("widgets/em-events-by-category.php");
@bhwebworks
bhwebworks / gist:1696799
Created January 29, 2012 02:16
Delete existing post revisions from your database
DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'
$prefix = '_bhww_sw_'; // Prefix for all fields
function bhww_sw_sermons_metaboxes( $meta_boxes ) {
global $prefix;
$meta_boxes[] = array(
'id' => 'bhww_sw_metabox',
'title' => 'Sermon Information',
'pages' => array('sw_sermon'), // post type
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
// Customize the Loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'my_cpt_taxonomy_custom_loop' );
function my_cpt_taxonomy_custom_loop() {
global $paged;
global $query_args; // any wp_query() args
// Get term
// Execute late to catch 'clone' and 'new draft' (Duplicate Post plugin)
add_filter( 'post_row_actions', 'bhww_core_remove_quick_edit_options', 100, 2 );
add_filter( 'page_row_actions', 'bhww_core_remove_quick_edit_options', 100, 2 );
function bhww_core_remove_quick_edit_options( $actions, $post ) {
if ( current_user_can( 'update_core' ) )
return $actions;
global $post;