Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bring back the missing editor for Posts page
- add_action( 'edit_form_after_title', 'rgc_posts_page_edit_form' );
- function rgc_posts_page_edit_form( $post ) {
- $posts_page = get_option( 'page_for_posts' );
- if ( $posts_page === $post->ID ) {
- add_post_type_support( 'page', 'editor' );
- }
- }
- remove_action( 'genesis_before_loop', 'genesis_do_posts_page_heading' );
- add_action( 'genesis_before_loop', 'sk_do_posts_page_heading' );
- /**
- * Add custom headline and page content to assigned posts page.
- *
- * If we're not on a posts page, then nothing extra is displayed.
- *
- * @since 2.2.1
- *
- * @return null Return early if `headings` is not enabled for Genesis accessibility, there is no
- * page for posts assigned, this is not the home (posts) page, or this is not the page found at `/`.
- */
- function sk_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;
- }
- $title = get_post( $posts_page )->post_title;
- $content = get_post( $posts_page )->post_content;
- $title_output = $content_output = '';
- if ( $title ) {
- $title_output = sprintf( '<h1 %s>%s</h1>', genesis_attr( 'archive-title' ), get_the_title( $posts_page ) );
- }
- if ( $content ) {
- $content_output = wpautop( $content );
- }
- if ( $title || $content ) {
- printf( '<div %s>', genesis_attr( 'posts-page-description' ) );
- if ( $title ) {
- printf( '<h1 %s>%s</h1>', genesis_attr( 'archive-title' ), get_the_title( $posts_page ) );
- }
- echo '<div class="posts-page-intro">'. $content_output .'</div>';
- echo '</div>';
- }
- }
Add Comment
Please, Sign In to add comment