Skip to content

Instantly share code, notes, and snippets.

View JiveDig's full-sized avatar

Mike Hemberger JiveDig

View GitHub Profile
@JiveDig
JiveDig / display_widget_area.php
Last active December 27, 2015 19:19
Display a genesis widget area
<?php
if ( is_active_sidebar( 'after-entry' ) ) {
genesis_widget_area( 'after-entry', array(
'before' => '<div class="after-entry">',
'after' => '</div>',
) );
}
@JiveDig
JiveDig / remove_jetpack_sharing_buttons.php
Created November 8, 2013 20:56
Remove default location of Jetpack's sharing buttons - Sharedaddy
// Remove default location of Jetpack sharing - Sharedaddy
// @link http://www.rfmeier.net/moving-jetpack-sharedaddy-links-outside-the-content-with-genesis/
// Display in template via: if( function_exists( 'sharing_display' ) ) { echo sharing_display(); }
add_action( 'init', 'custom_init', 11 );
function custom_init(){
// if sharing_display() function does not exist, return
if( ! function_exists( 'sharing_display' ) )
return;
@JiveDig
JiveDig / new_gist_file.php
Created November 9, 2013 05:21
Custom Genesis primary navigation extras
// Add custom code to Genesis primary navigation extras
// @link http://www.rfmeier.net/add-a-custom-primary-nav-extras-within-genesis/
add_filter( 'wp_nav_menu_items', 'custom_nav_item', 10, 2 );
function custom_nav_item( $menu, stdClass $args ){
// make sure we are in the primary menu
if ( 'primary' != $args->theme_location )
return $menu;
// see if a nav extra was already specified with Theme options
@JiveDig
JiveDig / sorry_no_posts.php
Created November 11, 2013 18:14
// Change 'Sorry, no posts' text for books
// Change Sorry no posts text for books
add_filter( 'genesis_noposts_text', 'child_noposts_text' );
/**Changes the No Posts text for search pages */
function child_noposts_text() {
if ( is_post_type_archive('download') OR ( is_tax('download_category' ) ) ) {
return '<span class="no-posts">' . __( 'Sorry, no books matched your criteria.', 'genesis' ) . '</span>';
}
}
@JiveDig
JiveDig / show_post_content.php
Created November 11, 2013 19:54
Show the post content if it exists
// Show post content if it exists
$post = get_post($post->ID);
if($post->post_content=="") {
echo '<p>No description provided.</p>';
} else {
genesis_do_post_content();
}
@JiveDig
JiveDig / body_class.php
Created November 11, 2013 20:16
Add body class
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
if ( is_page( 'sample-page' ))
$classes[] = 'custom-class';
return $classes;
}
@JiveDig
JiveDig / cpt_in_search.php
Created November 22, 2013 03:30
// Include all custom post types in search
<?php
// Include custom post types in search
// @link http://thomasgriffinmedia.com/blog/2010/11/how-to-include-custom-post-types-in-wordpress-search-results/
add_action('pre_get_posts', 'include_post_types_in_search');
function include_post_types_in_search( $query ) {
if ( $query->is_search )
$query->set( 'post_type', array( 'post', 'download' ) );
return $query;
};
@JiveDig
JiveDig / shorten_the_excerpt.php
Created November 22, 2013 04:11
Archive pages - shorten the content limit
<?php
// Shorten Excerpt
add_filter( 'genesis_pre_get_option_content_archive_limit', 'child_shorten_excerpt' );
function child_shorten_excerpt( $length ) {
$length = 200;
return $length;
}
@JiveDig
JiveDig / cpt_to_sitemap.php
Created November 22, 2013 04:26
Add custom post types to archive/sitemap
<?php
// Add custom post types to archive/sitemap
add_filter( 'getarchives_where' , 'ucc_getarchives_where_filter' , 10 , 2 );
function ucc_getarchives_where_filter( $where , $r ) {
$args = array( 'public' => true , '_builtin' => false );
$output = 'names'; $operator = 'and';
$post_types = get_post_types( $args , $output , $operator ); $post_types = array_merge( $post_types , array( 'post' ) ); $post_types = "'" . implode( "' , '" , $post_types ) . "'";
@JiveDig
JiveDig / remove_download_shortcode_column.php
Created November 25, 2013 14:49
Remove the shortcode column from Downloads dashboard
<?php
// Remove the shortcode column from Downloads dashboard
add_filter( 'edd_download_columns', 'child_remove_edd_shortcode_column' );
function child_remove_edd_shortcode_column( $download_columns ) {
unset( $download_columns['shortcode'] );
return $download_columns;
}
?>