A user in Genesis Facebook asks:
how to wrap portfolio items on archive-portfolio.php in h3 and not in h2 tags? i am using this plug in (https://github.com/copyblogger/genesis-portfolio-pro) thanks so much
genesis_entry_title_wrap
filter hook can be used to change the heading tags from the default h1 (if HTML5 with semantic headings) or h2 to another, say h3 like so:
// Wrap entry titles on 'portfolio' post type archive page in h3 tags | |
add_filter( 'genesis_entry_title_wrap', 'sk_set_custom_entry_title_wrap' ); | |
function sk_set_custom_entry_title_wrap( $wrap ) { | |
if ( is_post_type_archive( 'portfolio' ) ) { | |
$wrap = 'h3'; | |
} | |
return $wrap; | |
} |
Adding the above in child theme’s functions.php will change the entry titles wrapper from to h3 for all entries on the portfolio
CPT archive page.
Before:
After:
Source: genesis/lib/structure/post.php.
A+
Hey Sridhar how would you expand this out if you wanted more conditions? Stay single pages or custom post types?
You just need to change the if conditional.
For example this code will set h2 tags for entry titles in all static Pages: http://pastie.org/pastes/10573445/text