Remove entry content on blog and archive pages in Genesis
This tutorial provides the steps to remove Entry Content and Entry Excerpts on Post Page (Home), Archives(Categories, Tags, Author and Date) and Search Result in any theme based on Genesis Framework.
<?php //* Do NOT include the opening php tag // Remove entry content on blog and archives. add_action ( 'genesis_before_entry' , 'designody_remove_entry_content_archives' ); function designody_remove_entry_content_archives() { if (is_home() || is_archive() || is_search() ) remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); }
or use return early function
// Remove entry content on blog and archives. add_action ( 'genesis_before_entry' , 'designody_remove_entry_content_archives' ); function designody_remove_entry_content_archives() { if ( ! ( is_home() || is_archive() || is_search() ) ) { return; } remove_action( 'genesis_entry_content', 'genesis_do_post_content' ); }
and restrict this function on Custom Post Types
// Add entry content on CPTs. add_action ( 'genesis_before_entry' , 'designody_add_entry_content_cpt' ); function designody_add_entry_content_cpt() { if ( ! is_post_type_archive() ) { return; } add_action( 'genesis_entry_content', 'genesis_do_post_content' ); }