Display Entry Meta on Single Posts Only

This code removes the entry meta in the entry header which is also referred to as the post info, from all archives so it only displays on single posts in Genesis.

The code also removes the entry meta in the entry footer so it only displays on single posts also.

Here’s the before & after shots. The 1st image shows the entry meta on single posts only and the 2nd image shows the entry meta removed from all archives including the front & blog pages.

Single Post

entry-meta

Single Post Entry On Archives

removed-entry-meta

The method used to only display the entry meta on single posts is a bit tricky to workout.

add_action( 'loop_start', 'remove_entry_meta' );
function remove_entry_meta() {

if ( is_singular('post') )
return;

remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );

remove_action( 'genesis_entry_footer', 'genesis_post_meta' );  
}

Comments

3 responses to “Display Entry Meta on Single Posts Only”

  1. Jonathon Fowler Avatar
    Jonathon Fowler

    Hi, thanks for this. If I add this code to my functions.php, the meta is removed from the archive pages, which is what I want, but it also removes the meta from the blog pages…i thought this code keeps the metadata within the blog page, but removes it from the archive?

    1. Jonathon Fowler Avatar
      Jonathon Fowler

      Ignore my comment, I cleared my cache and all works great. Thank you very much Brad!

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.