neilgee
1/7/2016 - 7:40 AM

genesis_do_posts_page_heading

genesis_do_posts_page_heading

<?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>';

}