Make WordPress Core


Ignore:
Timestamp:
08/14/2013 04:38:01 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: first pass at matching code standards achieved with Twenty Thirteen development. See #24858, props obenland.

File:
1 edited

Legend:

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

    r24832 r25021  
    66?>
    77
    8 <article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?>>
    9     <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-featured">
     8<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     9    <a class="attachment-featured-featured" href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyfourteen' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="<?php the_ID(); ?>">
    1010        <?php
    11             $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 1 ) );
     11            if ( has_post_thumbnail() ) :
     12                the_post_thumbnail( 'featured-thumbnail-featured' );
    1213
    13             if ( '' != get_the_post_thumbnail() ) :
    14                 the_post_thumbnail( 'featured-thumbnail-featured' );
    15             elseif ( $images ) :
    16                 $image = array_shift( $images );
    17                 echo wp_get_attachment_image( $image->ID, 'featured-thumbnail-featured' );
    18             else : ?>
    19                 <img src="<?php echo get_template_directory_uri(); ?>/images/placeholder.png" alt="" class="featured-thumbnail-featured" /><?php
     14            else :
     15                $images = get_children( array(
     16                    'post_parent'    => get_the_ID(),
     17                    'post_type'      => 'attachment',
     18                    'post_mime_type' => 'image',
     19                    'orderby'        => 'menu_order',
     20                    'order'          => 'ASC',
     21                    'numberposts'    => 1,
     22                ) );
     23
     24                if ( $images ) :
     25                    $image = array_shift( $images );
     26                    echo wp_get_attachment_image( $image->ID, 'featured-thumbnail-featured' );
     27
     28                else : ?>
     29                    <img class="featured-thumbnail-featured" src="<?php echo get_template_directory_uri(); ?>/images/placeholder.png" alt="" /><?php
     30
     31                endif;
    2032            endif;
    2133        ?>
     
    2436    <div class="entry-wrap">
    2537        <header class="entry-header">
     38            <?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
    2639            <div class="entry-meta">
    27                 <?php
    28                     /* translators: used between list items, there is a space after the comma */
    29                     $categories_list = get_the_category_list( __( ', ', 'twentyfourteen' ) );
    30                     if ( $categories_list && twentyfourteen_categorized_blog() ) :
    31                 ?>
    32                 <span class="cat-links">
    33                     <?php echo $categories_list; ?>
    34                 </span>
    35                 <?php endif; // End if categories ?>
     40                <span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
    3641            </div><!-- .entry-meta -->
    37             <h1 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
     42            <?php endif; ?>
     43
     44            <?php the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); ?>
    3845        </header><!-- .entry-header -->
    3946
    40         <div class="entry-summary clearfix">
     47        <div class="entry-summary">
    4148            <?php the_excerpt(); ?>
    4249        </div><!-- .entry-summary -->
    4350    </div>
    44 
    45 </article><!-- #post-<?php the_ID(); ?> -->
     51</article><!-- #post-## -->
Note: See TracChangeset for help on using the changeset viewer.