diff --git a/README.md b/README.md index 7b2ce05..e229e8a 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ This plugin takes a different approach to how we use and display featured images * display _nothing_ if your featured image is already displayed in your content (the original image, not a resized version). * display a _default featured image_ as a backstretch image if one is uploaded. +__New in 1.3.0:__ optional Genesis archive headlines, descriptions, and excerpts for single posts/pages will display over the backstretch featured image. + __New in 1.2.0:__ on the Media Settings page, you can now upload a _Default Featured Image_ to be used site-wide. This image will be used on any post/page/custom post type which does not have a featured image set, plus archive and taxonomy pages. _Note: This plugin works with the Genesis Framework and child themes only._ @@ -95,12 +97,33 @@ Additionally/alternatively, you could set a max-height for the backstretch image max-height: 700px !important; } ``` + +### I'm using excerpts for a post type/posts/etc, but don't want them to show on the single page, even with the featured image. + +There's a filter for that, too. For example, adding this to your functions.php file would make sure that the excerpt does not show on single posts, or posts from the Staff post type, even if they have an excerpt. + +``` +add_filter( 'display_featured_image_genesis_omit_excerpt', 'rgc_omit_excerpts' ); +function rgc_omit_excerpts( $post_types ) { + $post_types[] = 'staff'; + $post_types[] = 'post'; + + return $post_types; +} +``` + +_Note: styling for the post title with excerpt is styled to be consistent with the optional Genesis taxonomy/author/custom post type archive titles and descriptions. You can override these in your stylesheet._ + ## Credits * Built by [Robin Cornett](http://robincornett.com/) ## Changelog +###1.3.0 +* optional taxonomy/author/CPT headline/description now show over leader image +* optional excerpt displays on single posts/pages as part of overlay; output is the same as taxonomy/author/CPT + ###1.2.2 * default image validation diff --git a/display-featured-image-genesis.php b/display-featured-image-genesis.php index 98e8028..4943fcc 100644 --- a/display-featured-image-genesis.php +++ b/display-featured-image-genesis.php @@ -12,7 +12,7 @@ * Plugin Name: Display Featured Image for Genesis * Plugin URI: http://github.com/robincornett/display-featured-image-genesis/ * Description: This plugin requires the Genesis Framework. It varies the display of the post or page featured image, depending on size. - * Version: 1.2.2 + * Version: 1.3.0 * Author: Robin Cornett * Author URI: http://robincornett.com * License: GPL-2.0+ diff --git a/includes/class-displayfeaturedimagegenesis-common.php b/includes/class-displayfeaturedimagegenesis-common.php index 253813d..78ea5e3 100644 --- a/includes/class-displayfeaturedimagegenesis-common.php +++ b/includes/class-displayfeaturedimagegenesis-common.php @@ -123,4 +123,14 @@ class Display_Featured_Image_Genesis_Common { return apply_filters( 'display_featured_image_genesis_use_default', array( 'attachment', 'revision', 'nav_menu_item' ) ); } + /** + * don't show excerpts even if they exist. + * @return filter creates a new filter for themes/plugins to omit the excerpt on a post type even if an excerpt exists. + * + * @since 1.3.0 + */ + public static function omit_excerpt() { + return apply_filters( 'display_featured_image_genesis_omit_excerpt', array( 'attachment', 'revision', 'nav_menu_item' ) ); + } + } diff --git a/includes/class-displayfeaturedimagegenesis-output.php b/includes/class-displayfeaturedimagegenesis-output.php index c533e1b..5b63174 100644 --- a/includes/class-displayfeaturedimagegenesis-output.php +++ b/includes/class-displayfeaturedimagegenesis-output.php @@ -98,7 +98,16 @@ class Display_Featured_Image_Genesis_Output { echo '
'; if ( !empty( $item->title ) ) { + $excerpt = get_the_excerpt(); + if ( is_single() && has_excerpt() && !in_array( get_post_type(), Display_Featured_Image_Genesis_Common::omit_excerpt() ) ) { + echo '
'; echo '

' . $item->title . '

'; + echo wpautop( $excerpt ); + echo '
'; + } + else { + echo '

' . $item->title . '

'; + } } if ( is_category() || is_tag() || is_tax() ) { remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 ); diff --git a/includes/class-displayfeaturedimagegenesis-settings.php b/includes/class-displayfeaturedimagegenesis-settings.php index f25e37b..e0d5c61 100644 --- a/includes/class-displayfeaturedimagegenesis-settings.php +++ b/includes/class-displayfeaturedimagegenesis-settings.php @@ -89,7 +89,10 @@ class Display_Featured_Image_Genesis_Settings { } echo ''; echo ''; - echo '

' . __( 'If you would like to use a default image for the featured image, upload it here. Must be a backstretch sized image.', 'display-featured-image-genesis' ) . '

'; + echo '

' . sprintf( + __( 'If you would like to use a default image for the featured image, upload it here. Must be at least %1$s pixels wide.', 'display-featured-image-genesis' ), + $item->large+1 + ) . '

'; } /** diff --git a/includes/css/display-featured-image-genesis.css b/includes/css/display-featured-image-genesis.css index ce71d1a..ca4172f 100644 --- a/includes/css/display-featured-image-genesis.css +++ b/includes/css/display-featured-image-genesis.css @@ -14,19 +14,24 @@ position: absolute; } -.big-leader .entry-title { +.big-leader .entry-title.featured-image-overlay { color: #fff; - margin-bottom: 24px; position: relative; text-align: center; } +.big-leader .entry-header, .big-leader .archive-description { background: rgba(255,255,255,.85); color: #333; + margin-bottom: 24px; padding: 24px; } +.big-leader p:last-child { + margin-bottom: 0; +} + img.featured { max-width: 100%; } diff --git a/languages/display-featured-image-genesis.pot b/languages/display-featured-image-genesis.pot index f45d5ac..0a73b4b 100644 --- a/languages/display-featured-image-genesis.pot +++ b/languages/display-featured-image-genesis.pot @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Display Featured Image for Genesis 1.2.1\n" +"Project-Id-Version: Display Featured Image for Genesis 1.3.0\n" "POT-Creation-Date: 2014-09-17 21:11-0500\n" -"PO-Revision-Date: 2014-10-21 18:03-0500\n" +"PO-Revision-Date: 2014-10-27 17:03-0500\n" "Last-Translator: Robin Cornett \n" "Language-Team: Robin Cornett \n" "Language: en_US\n" @@ -26,7 +26,7 @@ msgstr "" "X-Textdomain-Support: yes\n" #: ../includes/class-displayfeaturedimagegenesis-settings.php:25 -#: ../includes/class-displayfeaturedimagegenesis-settings.php:120 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:186 msgid "Display Featured Image for Genesis" msgstr "" @@ -55,25 +55,37 @@ msgid "" "of pixels. Default is zero." msgstr "" -#: ../includes/class-displayfeaturedimagegenesis-settings.php:95 -msgid "Sorry, your image is too small to serve as the default featured image." -msgstr "" - -#: ../includes/class-displayfeaturedimagegenesis-settings.php:98 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:91 msgid "Select Default Image" msgstr "" -#: ../includes/class-displayfeaturedimagegenesis-settings.php:99 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:93 +#, php-format msgid "" "If you would like to use a default image for the featured image, upload it " -"here. Must be a backstretch sized image." +"here. Must be at least %1$s pixels wide." msgstr "" -#: ../includes/class-displayfeaturedimagegenesis-settings.php:112 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:120 +#, php-format +msgid "" +"Sorry, that is an invalid file type. Return to the Media " +"Settings page and try again." +msgstr "" + +#: ../includes/class-displayfeaturedimagegenesis-settings.php:128 +#, php-format +msgid "" +"Sorry, that image is too small to use as your Default Featured Image. Your " +"image needs to be at least %1$s pixels wide. Return to the " +"Media Settings page and try again." +msgstr "" + +#: ../includes/class-displayfeaturedimagegenesis-settings.php:174 msgid "Reducto!" msgstr "" -#: ../includes/class-displayfeaturedimagegenesis-settings.php:113 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:175 msgid "" "Depending on how your header/nav are set up, or if you just do not want your " "backstretch image to extend to the bottom of the user screen, you may want " @@ -81,25 +93,30 @@ msgid "" "image, making it shorter." msgstr "" -#: ../includes/class-displayfeaturedimagegenesis-settings.php:115 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:177 msgid "Set a Default Featured Image" msgstr "" -#: ../includes/class-displayfeaturedimagegenesis-settings.php:116 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:178 msgid "" "You may set a large image to be used sitewide if a featured image is not " -"available. This image will show on posts, pages, and archives. It must be " -"larger than your site's Large Image setting, or else it will not " -"display. This is for a backstretch image only." +"available. This image will show on posts, pages, and archives." msgstr "" -#: ../includes/class-displayfeaturedimagegenesis.php:65 +#: ../includes/class-displayfeaturedimagegenesis-settings.php:180 +#, php-format +msgid "" +"Supported file types are: jpg, jpeg, png, and gif. The image must be at " +"least %1$s pixels wide." +msgstr "" + +#: ../includes/class-displayfeaturedimagegenesis.php:64 msgid "" "Sorry, Display Featured Image for Genesis works only with the Genesis " "Framework. It has been deactivated." msgstr "" -#: ../includes/class-displayfeaturedimagegenesis.php:69 +#: ../includes/class-displayfeaturedimagegenesis.php:68 #, php-format msgid "" "Sorry, Display Featured Image for Genesis works only with the Genesis " diff --git a/readme.txt b/readme.txt index 343fd6c..73ca218 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Donate link: https://robincornett.com/donate/ Tags: backstretch, featured image, genesis, studiopress Requires at least: 3.8 Tested up to: 4.0 -Stable tag: 1.2.2 +Stable tag: 1.3.0 License: GPL-2.0+ License URI: http://www.gnu.org/licenses/gpl-2.0.txt @@ -20,6 +20,8 @@ This plugin takes a different approach to how we use and display featured images * display _nothing_ if your featured image width is less than or equal to your Medium Media Setting. * display a _default featured image_ as a backstretch image if one is uploaded. +__New in 1.3.0:__ optional Genesis archive headlines, descriptions, and excerpts for single posts/pages will display over the backstretch featured image. + __New in 1.2.0:__ on the Media Settings page, you can now upload a _Default Featured Image_ to be used site-wide. This image will be used on any post/page/custom post type which does not have a featured image set, plus archive and taxonomy pages. _Note: This plugin works with the Genesis Framework and child themes only._ @@ -70,17 +72,37 @@ Additionally/alternatively, you could set a max-height for the backstretch image max-height: 700px !important; } += I'm using excerpts for a post type/posts/etc, but don't want them to show on the single page, even with the featured image. = + +There's a filter for that, too. For example, adding this to your functions.php file would make sure that the excerpt does not show on single posts, or posts from the Staff post type, even if they have an excerpt. + +```php +add_filter( 'display_featured_image_genesis_omit_excerpt', 'rgc_omit_excerpts' ); +function rgc_omit_excerpts( $post_types ) { + $post_types[] = 'staff'; + $post_types[] = 'post'; + + return $post_types; +} +``` + +_Note: styling for the post title with excerpt is styled to be consistent with the optional Genesis taxonomy/author/custom post type archive titles and descriptions. You can override these in your stylesheet._ + == Screenshots == 1. Screenshot of a page using the Backstretch Featured Image 2. Use the WordPress Customizer to set a Default Featured Image. == Upgrade Notice == -= 1.2.2 = -New feature: Set a Default Featured Image += 1.3.0 = +New feature: Set a Default Featured Image (1.2.0); show archive headlines/descriptions/excerpts with backstretch featured image == Changelog == += 1.3.0 = +* optional taxonomy/author/CPT headline/description now show over leader image +* optional excerpt displays on single posts/pages as part of overlay; output is the same as taxonomy/author/CPT + = 1.2.2 = * default image validation