Skip to content

Instantly share code, notes, and snippets.

@pixelloop
Last active March 8, 2016 03:16
Show Gist options
  • Save pixelloop/ecf8f51d38d2c6c60a88 to your computer and use it in GitHub Desktop.
Save pixelloop/ecf8f51d38d2c6c60a88 to your computer and use it in GitHub Desktop.
<?php // Remove this line
/* Blog Intro */
add_action( 'genesis_before_loop', 'xgenesis_blog_intro' );
function xgenesis_blog_intro() {
$posts_page = get_option( 'page_for_posts' );
if ( !is_home() ) {
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 class="archive-title">%s</h1>', $title );
}
if ( $content ) {
$content_output = wpautop( $content );
}
if ( $title || $content ) {
printf( '<div class="archive-description">%s</div>', $title_output . $content_output );
}
}
add_action( 'edit_form_after_title', 'xgenesis__posts_page_edit_form' );
function xgenesis_posts_page_edit_form() {
global $post, $post_type, $post_ID;
if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) {
add_post_type_support( $post_type, 'editor' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment