lundi 29 décembre 2014

Removing entry header based on post format in Genesis theme


Working on a genesis child theme -- sixteen nine -- and I've turned on post formats. I'd like to remove the post title from the entry head section for certain formats -- aside, gallery, image, etc -- but can't seem to figure it out. This is where I started:



remove_action( 'genesis_entry_header','genesis_do_post_title' );
add_action( 'genesis_entry_header','post_format_post_title' );


function post_format_post_title() {

if ( has_post_format('aside') ) {
remove_action( 'genesis_entry_header','genesis_do_post_title' );
}}


That removes the title, but from every post regardless of format. Someone in another forum gave me this:



add_action( 'genesis_before_entry', 'possibly_remove_entry_header' );

function possibly_remove_entry_header()
{
//* get the post format
$post_format = get_post_format();

//* remove the entry header based on the post format
switch( $post_format )
{
case 'aside':

//* remove the entry header. See Genesis/lib/structure/post.php
remove_action( 'genesis_entry_header', 'genesis_do_post_format_image', 4 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
break;

default:
break;
}
}


That did the same thing, removed all entry header content from all posts regardless of format.


Any thoughts on how to accomplish this? Thanks very much.





Aucun commentaire:

Enregistrer un commentaire