Skip to content

Instantly share code, notes, and snippets.

@floroxmar
Created April 15, 2014 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floroxmar/10698039 to your computer and use it in GitHub Desktop.
Save floroxmar/10698039 to your computer and use it in GitHub Desktop.
Add page title on blog page
/*
* Add page title on blog page
*/
add_action( 'genesis_before_loop', 'ja_blog_page_title' );
function ja_blog_page_title(){
//check if it is the blog page
if( is_page_template( 'page_blog.php' ) ){
//get the page title
$title = get_the_title();
//* Page title wrapper
$wrap = 'h1';
//* 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 .= "{$title}</{$wrap}>";
echo $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment