mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 02:10:45 +01:00
Twenty Fourteen: remove excerpts from featured posts, and display full titles instead. Props iamtakashi, closes #25581.
Built from https://develop.svn.wordpress.org/trunk@25804 git-svn-id: http://core.svn.wordpress.org/trunk@25716 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6a3e7ff614
commit
83f5f48dea
@ -27,10 +27,6 @@
|
|||||||
if ( $images ) :
|
if ( $images ) :
|
||||||
$image = array_shift( $images );
|
$image = array_shift( $images );
|
||||||
echo wp_get_attachment_image( $image->ID, 'featured-thumbnail-featured' );
|
echo wp_get_attachment_image( $image->ID, 'featured-thumbnail-featured' );
|
||||||
|
|
||||||
else : ?>
|
|
||||||
<img class="featured-thumbnail-featured" src="<?php echo get_template_directory_uri(); ?>/images/placeholder.png" alt="" /><?php
|
|
||||||
|
|
||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
@ -46,9 +42,5 @@
|
|||||||
|
|
||||||
<?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
|
<?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
|
||||||
</header><!-- .entry-header -->
|
</header><!-- .entry-header -->
|
||||||
|
|
||||||
<div class="entry-summary">
|
|
||||||
<?php the_excerpt(); ?>
|
|
||||||
</div><!-- .entry-summary -->
|
|
||||||
</div>
|
</div>
|
||||||
</article><!-- #post-## -->
|
</article><!-- #post-## -->
|
||||||
|
@ -69,7 +69,7 @@ function twentyfourteen_setup() {
|
|||||||
|
|
||||||
// Add several sizes for Post Thumbnails.
|
// Add several sizes for Post Thumbnails.
|
||||||
add_image_size( 'featured-thumbnail-large', 672, 0 );
|
add_image_size( 'featured-thumbnail-large', 672, 0 );
|
||||||
add_image_size( 'featured-thumbnail-featured', 672, 336, true );
|
add_image_size( 'featured-thumbnail-featured', 672, 372, true );
|
||||||
add_image_size( 'featured-thumbnail-formatted', 306, 0 );
|
add_image_size( 'featured-thumbnail-formatted', 306, 0 );
|
||||||
|
|
||||||
// This theme uses wp_nav_menu() in two locations.
|
// This theme uses wp_nav_menu() in two locations.
|
||||||
@ -253,63 +253,6 @@ function twentyfourteen_admin_fonts() {
|
|||||||
}
|
}
|
||||||
add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
|
add_action( 'admin_print_scripts-appearance_page_custom-header', 'twentyfourteen_admin_fonts' );
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the post excerpt length to 20 words.
|
|
||||||
*
|
|
||||||
* @since Twenty Fourteen 1.0
|
|
||||||
*
|
|
||||||
* @param int $length
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function twentyfourteen_excerpt_length( $length ) {
|
|
||||||
return 20;
|
|
||||||
}
|
|
||||||
add_filter( 'excerpt_length', 'twentyfourteen_excerpt_length' );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a "Continue Reading" link for excerpts.
|
|
||||||
*
|
|
||||||
* @since Twenty Fourteen 1.0
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function twentyfourteen_continue_reading_link() {
|
|
||||||
return ' <a href="'. esc_url( get_permalink() ) . '" class="more-link">' . __( 'Read More <span class="meta-nav">→</span>', 'twentyfourteen' ) . '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace "[...]" (appended to automatically generated excerpts) with an
|
|
||||||
* ellipsis and twentyfourteen_continue_reading_link().
|
|
||||||
*
|
|
||||||
* @since Twenty Fourteen 1.0
|
|
||||||
*
|
|
||||||
* @param string $more
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function twentyfourteen_auto_excerpt_more( $more ) {
|
|
||||||
return ' …' . twentyfourteen_continue_reading_link();
|
|
||||||
}
|
|
||||||
add_filter( 'excerpt_more', 'twentyfourteen_auto_excerpt_more' );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a pretty "Continue Reading" link to custom post excerpts.
|
|
||||||
*
|
|
||||||
* To override this link in a child theme, remove the filter and add your own
|
|
||||||
* function tied to the get_the_excerpt filter hook.
|
|
||||||
*
|
|
||||||
* @since Twenty Fourteen 1.0
|
|
||||||
*
|
|
||||||
* @param string $output
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function twentyfourteen_custom_excerpt_more( $output ) {
|
|
||||||
if ( has_excerpt() && ! is_attachment() ) {
|
|
||||||
$output .= twentyfourteen_continue_reading_link();
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
|
||||||
add_filter( 'get_the_excerpt', 'twentyfourteen_custom_excerpt_more' );
|
|
||||||
|
|
||||||
if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
|
if ( ! function_exists( 'twentyfourteen_the_attached_image' ) ) :
|
||||||
/**
|
/**
|
||||||
* Print the attached image with a link to the next attached image.
|
* Print the attached image with a link to the next attached image.
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB |
@ -3013,6 +3013,10 @@ span + .edit-link:before,
|
|||||||
margin-left: 60px;
|
margin-left: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.featured-content {
|
||||||
|
margin-bottom: -24px;
|
||||||
|
}
|
||||||
|
|
||||||
.attachment-featured-featured {
|
.attachment-featured-featured {
|
||||||
height: 192px;
|
height: 192px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user