show optional archive headlines/descriptions/excerpts with backstretch featured image

This commit is contained in:
Robin Cornett
2014-10-27 17:17:13 -04:00
parent c392843512
commit 5dfd43924c
8 changed files with 115 additions and 26 deletions
+23
View File
@@ -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
+1 -1
View File
@@ -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+
@@ -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' ) );
}
}
@@ -98,7 +98,16 @@ class Display_Featured_Image_Genesis_Output {
echo '<div class="big-leader"><div class="wrap">';
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 '<div class="entry-header">';
echo '<h1 class="entry-title">' . $item->title . '</h1>';
echo wpautop( $excerpt );
echo '</div>';
}
else {
echo '<h1 class="entry-title featured-image-overlay">' . $item->title . '</h1>';
}
}
if ( is_category() || is_tag() || is_tax() ) {
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
@@ -89,7 +89,10 @@ class Display_Featured_Image_Genesis_Settings {
}
echo '<input type="url" id="default_image_url" name="displayfeaturedimage_default" value="' . $item->fallback . '" />';
echo '<input id="upload_default_image" type="button" class="upload_default_image button" value="' . __( 'Select Default Image', 'display-featured-image-genesis' ) . '" />';
echo '<p class="description">' . __( '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' ) . '</p>';
echo '<p class="description">' . 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
) . '</p>';
}
/**
@@ -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%;
}
+36 -19
View File
@@ -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 <hello@robincornett.com>\n"
"Language-Team: Robin Cornett <hello@robincornett.com>\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. <a href=\"%1$s\">Return to the Media "
"Settings page and try again.</a>"
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. <a href=\"%2$s\">Return to the "
"Media Settings page and try again.</a>"
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&#39;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 "
+25 -3
View File
@@ -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