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
@@ -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%;
}