Remove Post Meta from Category Archive Pages in a Genesis Theme in WordPress

Archive pages in a Genesis theme by default, include the post info which displays  the post author, post date and comments info and the post meta which displays the category and tag values.

 

genesis-remove-post-meta-archive-pages

You may want to have these values removed or edited for your Archive pages but leave them intact for regular posts. This is possible by adding an action and function in your themes functions.php file:

// Remove Post Info, Post Meta from Archive Pages
function themeprefix_remove_post_meta() {
	if (is_archive()) {
		remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
		remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
		}
}
add_action ( 'genesis_entry_header', 'themeprefix_remove_post_meta' );

The code looks to see if the page is an Archive page which would include all Archive Pages including categories and tag pages. Then these post info and post meta data is removed just from that type of page.

genesis-remove-post-info

 

The remove action for the genesis_post_info has a priority number set (12), this is because the original action is added with this number in the post.php file in the structure directory of the main Genesis framework. To remove the original action they have to be exactly the same.

The code snippet uses a conditional statement if, you can target a number of pages by adding in the right conditions.

1 Comment

  1. Jaime Lopez on June 29, 2016 at 9:45 am

    Hi, I´ve read your post, and I´ll use it for mya cat archive pages;

    But for the rest, I would like to use exactly the opposite system : display the cat. name and the post_type (I have CPT) in the archive pages of post (last posts, searh,….) bot not in the post.
    I mean: Remove Post Info, Post Meta at posts but not in the Archive Pages

    Could you help me? Thanks in advance.

Leave a Comment





%d bloggers like this: