From 8013ccee7eb980e4cfa1118afa4f484c77991d4b Mon Sep 17 00:00:00 2001 From: Robin Cornett Date: Sun, 30 Aug 2015 17:01:04 -0400 Subject: [PATCH] Fix title output wonky () ended up removing titles on blog templates. This fixes that, and hopefully parses out the logic to make more sense. --- ...ass-displayfeaturedimagegenesis-output.php | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/includes/class-displayfeaturedimagegenesis-output.php b/includes/class-displayfeaturedimagegenesis-output.php index a5307e9..96d639d 100644 --- a/includes/class-displayfeaturedimagegenesis-output.php +++ b/includes/class-displayfeaturedimagegenesis-output.php @@ -211,18 +211,8 @@ class Display_Featured_Image_Genesis_Output { } elseif ( ! $keep_titles && ! in_array( get_post_type(), $do_not_move_title ) ) { // if titles are being moved to overlay the image - $front_page_show = is_front_page() && $show_front_page_title ? true : false; - if ( ! empty( $this->item->title ) && ( ! is_front_page() || $front_page_show ) ) { - - $class = is_singular() ? 'entry-title' : 'archive-title'; - $itemprop = genesis_html5() ? 'itemprop="headline"' : ''; - $title = $this->item->title; - $title_output = sprintf( '

%s

', $class, $itemprop, $title ); - - $title_output = apply_filters( 'display_featured_image_genesis_modify_title_overlay', $title_output, esc_attr( $class ), esc_attr( $itemprop ), $title ); - - echo wp_kses_post( $title_output ); - + if ( ! empty( $this->item->title && $this->do_the_title() ) ) { + echo wp_kses_post( $this->do_the_title() ); } remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' ); @@ -262,6 +252,25 @@ class Display_Featured_Image_Genesis_Output { echo wp_kses_post( $image ); } + /** + * Return the title. + * @return string title with markup. + * + * @since 2.3.1 + */ + protected function do_the_title() { + if ( ( is_front_page() && ! $this->show_front_title ) || ( is_page_template( 'page_blog.php' ) && genesis_a11y( 'headings' ) ) ) { + return; + } + $class = is_singular() ? 'entry-title' : 'archive-title'; + $itemprop = genesis_html5() ? 'itemprop="headline"' : ''; + $title = $this->item->title; + $title_output = sprintf( '

%s

', $class, $itemprop, $title ); + + $title_output = apply_filters( 'display_featured_image_genesis_modify_title_overlay', $title_output, esc_attr( $class ), esc_attr( $itemprop ), $title ); + return $title_output; + } + /** * Separate archive titles from descriptions. Titles show in leader image * area; descriptions show before loop.