Created
January 7, 2016 07:40
genesis_do_posts_page_heading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
///genesis/lib/structure/archive.php | |
add_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' ); | |
/** | |
* Add custom headline and description to assigned posts page. | |
* | |
* If we're not on a posts page, then nothing extra is displayed. | |
* | |
* @since 2.2.1 | |
* | |
* @uses genesis_a11y() Check if a post type should potentially support an archive setting page. | |
* @uses genesis_do_post_title() Get list of custom post types which need an archive settings page. | |
* | |
* @return null Return early if not on relevant posts page. | |
*/ | |
function genesis_do_posts_page_heading() { | |
if ( ! genesis_a11y( 'headings' ) ) { | |
return; | |
} | |
$posts_page = get_option( 'page_for_posts' ); | |
if ( is_null( $posts_page ) ) { | |
return; | |
} | |
if ( ! is_home() || genesis_is_root_page() ) { | |
return; | |
} | |
printf( '<div %s>', genesis_attr( 'posts-page-description' ) ); | |
printf( '<h1 %s>%s</h1>', genesis_attr( 'archive-title' ), get_the_title( $posts_page ) ); | |
echo '</div>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment