Make WordPress Core

Changeset 25088


Ignore:
Timestamp:
08/22/2013 05:02:34 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: Align post format handling with Twenty Thirteen. Props Frank Klein and obenland, see #24877.

Location:
trunk/src/wp-content/themes/twentyfourteen
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/archive.php

    r25023 r25088  
    4848                                        the_post();
    4949
    50                                         twentyfourteen_get_template_part();
     50                                        get_template_part( 'content', get_post_format() );
    5151                                endwhile;
    5252                                twentyfourteen_paging_nav();
  • trunk/src/wp-content/themes/twentyfourteen/content-post-format.php

    r25023 r25088  
    1 <?php
    2 /**
    3  * @package WordPress
    4  * @subpackage Twenty_Fourteen
    5  */
    6 ?>
    7 
    8 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    9         <?php
    10                 if ( has_post_format( 'gallery' ) ) :
    11                         $images = get_children( array( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) );
    12                         if ( $images ) :
    13                                 $image = array_shift( $images );
    14                                 ?>
    15                                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyfourteen' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="<?php the_ID(); ?>" class="attachment-featured-thumbnail">
    16                                 <?php echo wp_get_attachment_image( $image->ID, 'featured-thumbnail-large' ); ?>
    17                                 </a>
    18                                 <?php
    19                         endif;
    20                 endif;
    21         ?>
    22 
    23         <header class="entry-header">
    24                 <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
    25                 <div class="entry-meta">
    26                         <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
    27                 </div><!-- .entry-meta -->
    28                 <?php endif; ?>
    29 
    30                 <?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
    31 
    32                 <div class="entry-meta">
    33                         <span class="post-format">
    34                                 <a class="entry-format" href="<?php echo esc_url( get_post_format_link( get_post_format() ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( get_post_format() ) ) ); ?>"><?php echo get_post_format_string( get_post_format() ); ?></a>
    35                         </span>
    36 
    37                         <?php
    38                                 if ( 'post' == get_post_type() )
    39                                         twentyfourteen_posted_on();
    40 
    41                                 if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) :
    42                         ?>
    43                         <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
    44                         <?php endif; ?>
    45 
    46                         <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
    47                 </div><!-- .entry-meta -->
    48         </header><!-- .entry-header -->
    49 
    50         <div class="entry-content">
    51                 <?php
    52                         the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ) );
    53                         wp_link_pages( array(
    54                                 'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
    55                                 'after'       => '</div>',
    56                                 'link_before' => '<span>',
    57                                 'link_after'  => '</span>',
    58                         ) );
    59                 ?>
    60         </div><!-- .entry-content -->
    61 
    62         <footer class="entry-meta">
    63                 <?php if ( has_post_format( array( 'quote', 'aside' ) ) ) : ?>
    64                 <div class="entry-meta">
    65                         <?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
    66                 </div>
    67                 <?php endif; ?>
    68 
    69                 <?php if ( has_tag() ) : ?>
    70                 <span class="tag-links"><?php echo get_the_tag_list(); ?></span>
    71                 <?php endif; ?>
    72         </footer><!-- .entry-meta -->
    73 </article><!-- #post-## -->
  • trunk/src/wp-content/themes/twentyfourteen/content-single.php

    r25023 r25088  
    1 <?php
    2 /**
    3  * @package WordPress
    4  * @subpackage Twenty_Fourteen
    5  */
    6 ?>
    7 
    8 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    9         <?php if ( has_post_thumbnail() && ! has_post_format( array( 'video', 'image', 'aside', 'link', 'quote' ) ) ) : ?>
    10         <div class="attachment-featured-thumbnail">
    11         <?php the_post_thumbnail( 'featured-thumbnail-large' ); ?>
    12         </div>
    13         <?php endif; ?>
    14 
    15         <header class="entry-header">
    16                 <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
    17                 <div class="entry-meta">
    18                         <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
    19                 </div><!-- .entry-meta -->
    20                 <?php
    21                         endif;
    22 
    23                         if ( ! has_post_format( array( 'status', 'chat', 'aside', 'link', 'quote', 'audio' ) ) ) :
    24                                 the_title( '<h1 class="entry-title">', '</h1>' );
    25                         endif;
    26                 ?>
    27 
    28                 <div class="entry-meta">
    29                         <?php if ( has_post_format( array( 'status', 'chat', 'aside', 'link', 'quote', 'audio' ) ) ) : ?>
    30                         <span class="post-format">
    31                                 <a class="entry-format" href="<?php echo esc_url( get_post_format_link( get_post_format() ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( get_post_format() ) ) ); ?>"><?php echo get_post_format_string( get_post_format() ); ?></a>
    32                         </span>
    33                         <?php endif; ?>
    34 
    35                         <?php twentyfourteen_posted_on(); ?>
    36 
    37                         <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?>
    38                         <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
    39                         <?php endif; ?>
    40 
    41                         <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
    42                 </div><!-- .entry-meta -->
    43         </header><!-- .entry-header -->
    44 
    45         <div class="entry-content">
    46                 <?php
    47                         the_content();
    48                         wp_link_pages( array(
    49                                 'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
    50                                 'after'       => '</div>',
    51                                 'link_before' => '<span>',
    52                                 'link_after'  => '</span>',
    53                         ) );
    54                 ?>
    55         </div><!-- .entry-content -->
    56 
    57         <footer class="entry-meta">
    58                 <?php if ( has_post_format( array( 'quote', 'aside' ) ) ) : ?>
    59                 <div class="entry-meta">
    60                         <?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
    61                 </div><!-- .entry-meta -->
    62                 <?php endif; ?>
    63 
    64                 <?php if ( has_tag() ) : ?>
    65                         <span class="tag-links">
    66                                 <?php echo get_the_tag_list(); ?>
    67                         </span>
    68                 <?php endif; ?>
    69         </footer><!-- .entry-meta -->
    70 </article><!-- #post-## -->
  • trunk/src/wp-content/themes/twentyfourteen/content.php

    r25021 r25088  
    1919                <?php endif; ?>
    2020
    21                 <h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
     21                <?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
    2222
    2323                <div class="entry-meta">
    24                         <?php if ( has_post_format( 'gallery' ) ) : ?>
    25                         <span class="post-format">
    26                                 <a class="entry-format" href="<?php echo esc_url( get_post_format_link( 'gallery' ) ); ?>" title="<?php echo esc_attr( sprintf( __( 'All %s posts', 'twentyfourteen' ), get_post_format_string( 'gallery' ) ) ); ?>"><?php echo get_post_format_string( 'gallery' ); ?></a>
    27                         </span>
    2824                        <?php
    29                                 endif;
    30 
    3125                                if ( 'post' == get_post_type() )
    3226                                        twentyfourteen_posted_on();
  • trunk/src/wp-content/themes/twentyfourteen/front-page.php

    r25069 r25088  
    2525                                                                the_post();
    2626
    27                                                                 twentyfourteen_get_template_part();
     27                                                                get_template_part( 'content', get_post_format() );
    2828
    2929                                                                comments_template();
  • trunk/src/wp-content/themes/twentyfourteen/inc/template-tags.php

    r25087 r25088  
    144144add_action( 'edit_category', 'twentyfourteen_category_transient_flusher' );
    145145add_action( 'save_post',     'twentyfourteen_category_transient_flusher' );
    146 
    147 /**
    148  * Include the Post-Format-specific template for the content.
    149  * This is called in index.php and single.php
    150  */
    151 function twentyfourteen_get_template_part() {
    152         if ( has_post_format( array( 'aside', 'quote', 'link', 'video', 'image' ) ) )
    153                 get_template_part( 'content', 'post-format' );
    154         else
    155                 get_template_part( 'content', get_post_format() );
    156 }
  • trunk/src/wp-content/themes/twentyfourteen/index.php

    r25023 r25088  
    2323                                        the_post();
    2424
    25                                         twentyfourteen_get_template_part();
     25                                        get_template_part( 'content', get_post_format() );
    2626                                endwhile;
    2727                                twentyfourteen_paging_nav();
  • trunk/src/wp-content/themes/twentyfourteen/search.php

    r25023 r25088  
    2222                                        the_post();
    2323
    24                                         twentyfourteen_get_template_part();
     24                                        get_template_part( 'content', get_post_format() );
    2525                                endwhile;
    2626                                twentyfourteen_paging_nav();
  • trunk/src/wp-content/themes/twentyfourteen/single.php

    r25023 r25088  
    1515                                the_post();
    1616
    17                                 get_template_part( 'content', 'single' );
     17                                get_template_part( 'content', get_post_format() );
    1818
    1919                                twentyfourteen_post_nav();
  • trunk/src/wp-content/themes/twentyfourteen/style.css

    r25087 r25088  
    10261026}
    10271027.post-formatted-posts .entry-title:after,
    1028 .content-area span + span.entry-date:before,
     1028.content-area span + .entry-date:before,
    10291029span + .byline:before,
    10301030span + .comments-link:before,
     
    11401140.format-video {
    11411141        border-top: 1px solid rgba(0, 0, 0, 0.1);
    1142 }
    1143 .format-aside .entry-title,
    1144 .format-quote .entry-title,
    1145 .format-link .entry-title {
    1146         display: none;
    11471142}
    11481143.format-aside .entry-content,
Note: See TracChangeset for help on using the changeset viewer.