Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active December 28, 2015 21:09
Show Gist options
  • Save srikat/7562415 to your computer and use it in GitHub Desktop.
Save srikat/7562415 to your computer and use it in GitHub Desktop.
Filter Genesis H1 Post Titles to remove hyperlinks on Category pages. http://sridharkatakam.com/remove-hyperlinks-post-titles-gensis/
/**
* Filter Genesis H1 Post Titles to remove hyperlinks on Category pages
*
*/
add_filter( 'genesis_post_title_output', 'sk_post_title_output', 15 );
function sk_post_title_output( $title ) {
if( is_category() )
$title = apply_filters( 'genesis_post_title_text', get_the_title() );
$wrap = 'h1';
//* Also, if HTML5 with semantic headings, wrap in H1
$wrap = genesis_html5() && genesis_get_seo_option( 'semantic_headings' ) ? 'h1' : $wrap;
//* Build the output
$output = genesis_markup( array(
'html5' => "<{$wrap} %s>",
'xhtml' => sprintf( '<%s class="entry-title">%s</%s>', $wrap, $title, $wrap ),
'context' => 'entry-title',
'echo' => false,
) );
$output .= genesis_html5() ? "{$title}</{$wrap}>" : '';
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment