Skip to content

Instantly share code, notes, and snippets.

@jdspiral
jdspiral / custom-genesis-loop.php
Last active May 22, 2017 23:16
Custom Genesis Loop
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'jds_do_loop');
function jds_do_loop() {
$args = array(
'posts_per_page' => 20,
'post_type' => 'page',
'post_parent' => 5,
'paged' => get_query_var( 'paged' ),
'orderby' => 'title',
'order' => 'ASC',
@jdspiral
jdspiral / remove-archives-blog.php
Last active August 29, 2015 14:16
Remove Genesis Archives and Blog Templates
// Remove Genesis Archives and Blog Templates
function jds_remove_genesis_page_templates( $page_templates ) {
unset( $page_templates['page_archive.php'] );
unset( $page_templates['page_blog.php'] );
return $page_templates;
}
add_filter( 'theme_page_templates', 'jds_remove_genesis_page_templates' );
@jdspiral
jdspiral / blog-posts-sidebar.php
Last active August 29, 2015 14:16
Add blog sidebar to blog (home.php), posts (single.php), categories, and tags
// Add blog sidebar to blog (home.php), posts (single.php), categories, and tags
add_action('genesis_before_sidebar_widget_area', 'jds_get_blog_sidebar');
function jds_get_blog_sidebar() {
if (is_home() || is_single() || is_category() || is_tag()) :
remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
dynamic_sidebar( 'blog' );
endif;
}
@jdspiral
jdspiral / register-custom-sidebar.php
Last active August 29, 2015 14:16
Register Custom Sidebar
// Register Custom Sidebar
function jds_blog_sidebar() {
/* Register the primary sidebar. */
register_sidebar(
array(
'id' => 'blog',
'name' => __( 'Blog Sidebar', 'textdomain' ),
'description' => __( 'This your sidebar description.', 'textdomain' ),
'before_widget' => '<section id="%1$s" class="widget %2$s blog-sidebar">',
'after_widget' => '</section>',
@jdspiral
jdspiral / remove-breadcrumbs-custom-template.php
Last active August 29, 2015 14:13
Remove breadcrumb from a custom template page
//* Remove breadcrumb from a custom template page
add_action( 'genesis_before', 'jds_remove_genesis_breadcrumb' );
function jds_remove_genesis_breadcrumb() {
if ( is_page_template( 'page_landing.php' ) )
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
}
@jdspiral
jdspiral / edit-read-more-link.php
Last active August 29, 2015 14:13
Edit Read More Link
@jdspiral
jdspiral / gist:f11f98c88cecc8da1b10
Created January 13, 2015 20:11
Custom Image Sizes
//Custom Image Sizes
add_image_size( 'featured-image', 236, 153, TRUE );
@jdspiral
jdspiral / gist:cfbeed52c11993f8c6e4
Last active August 29, 2015 14:13
Add featured image
//* Add featured image
add_action ( 'genesis_entry_header', 'jds_featured_image', 15);
function jds_featured_image() {
if ( is_single() )
return;
if ($image = genesis_get_image('format=url&amp;size=thumbnail')) {
echo '<div class="alignleft">';
printf('<a href="%s"><img class="alignleft" src="%s" alt="%s" /></a>', get_permalink(), $image, the_title_attribute('echo=0'));
echo '</div>';
}
@jdspiral
jdspiral / gist:37cbd29b613f8aa255a8
Created January 13, 2015 20:09
Customize the post info function
//* Customize the post info function
remove_action( 'genesis_entry_header', 'genesis_post_info', 12);
add_action( 'genesis_entry_header', 'genesis_post_info', 9 );
add_filter( 'genesis_post_info', 'jds_post_info_filter' );
function jds_post_info_filter($post_info) {
if (is_home() || is_archive()) {
$post_info = '[post_categories before=""] [post_comments] [post_edit]';
return $post_info;
}
@jdspiral
jdspiral / shortcode.php
Last active November 18, 2015 04:49
Enable Shortcode in widgets
// Enable Shortcode in widgets - Note: This is not recommended. This is plugin functionality.
add_filter('widget_text', 'do_shortcode');