Remove Post Info and Meta from Teasers

If you’re using the Genesis Grid Loop plugin, this will remove the post info and meta from appearing on those posts. This typically includes the post date, author, and comment count displayed above the post; the categories and tags displayed below the post.

The Genesis Grid Loop plugin allows you to break your blog and other archive pages into features (full width posts) and teasers (posts displayed in multiple columns). See my blog as an example.

<?php
/**
* Remove Post Info and Meta from Teasers
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/remove-post-info-meta-teasers/
*/
function be_remove_info_from_teasers() {
// First, we make sure we're in the grid loop.
if( ! apply_filters( 'is_genesis_grid_loop', false ) )
return;
// Remove if a teaser
if( in_array( 'teaser', get_post_class() ) ) {
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
}
}
add_action( 'genesis_before_entry', 'be_remove_info_from_teasers' );
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk