Make WordPress Core


Ignore:
Timestamp:
05/17/2010 06:36:11 AM (17 years ago)
Author:
nacin
Message:

In Twenty Ten, documentation and code improvements. see #12695.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/loop.php

    r14707 r14708  
    1010 * @package WordPress
    1111 * @subpackage Twenty_Ten
    12  * @since 3.0.0
     12 * @since Twenty Ten 1.0
    1313 */
    1414?>
    … …  
    2727                <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
    2828                <div class="entry-content">
    29                         <p><?php _e( 'Apologies, but no results were found for the requested Archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
     29                        <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
    3030                        <?php get_search_form(); ?>
    3131                </div><!-- .entry-content -->
    … …  
    3333<?php endif; ?>
    3434
    35 <?php /* Start the Loop */ ?>
     35<?php
     36        /* Start the Loop.
     37         *
     38         * In Twenty Ten we use the same loop in multiple contexts.
     39         * It is broken into three main parts: when we're displaying
     40         * posts that are in the gallery category, when we're displaying
     41         * posts in the asides category, and finally all other posts.
     42         *
     43         * Additionally, we sometimes check for whether we are on an
     44         * archive page, a search page, etc., allowing for small differences
     45         * in the loop on each template without actually duplicating
     46         * the rest of the loop that is shared.
     47         *
     48         * Without further ado, the loop:
     49         */ ?>
    3650<?php while ( have_posts() ) : the_post(); ?>
    3751
    38 <?php /* How to Display posts in the Gallery Category */ ?>
     52<?php /* How to display posts in the Gallery category. */ ?>
     53
    3954        <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) ) : ?>
    4055                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    … …  
    7287
    7388<?php /* How to display posts in the asides category */ ?>
     89
    7490        <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) ) : ?>
    7591                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    76         <?php if ( is_archive() || is_search() ) : // Only display Excerpts for archives & search ?>
     92
     93                <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
    7794                        <div class="entry-summary">
    78                                 <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
     95                                <?php the_excerpt(); ?>
    7996                        </div><!-- .entry-summary -->
    80         <?php else : ?>
     97                <?php else : ?>
    8198                        <div class="entry-content">
    8299                                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    83100                        </div><!-- .entry-content -->
    84         <?php endif; ?>
     101                <?php endif; ?>
    85102
    86103                        <div class="entry-utility">
    … …  
    90107                                <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    91108                        </div><!-- #entry-utility -->
    92                 </div><!-- #post-<?php the_ID(); ?> -->
     109                </div><!-- #post-(id) -->
    93110
    94 <?php /* How to display all other posts */ ?>
     111<?php /* How to display all other posts. */ ?>
     112
    95113        <?php else : ?>
    96114                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    … …  
    101119                        </div><!-- .entry-meta -->
    102120
    103         <?php if ( is_archive() || is_search() ) : // Only display Excerpts for archives & search ?>
     121        <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    104122                        <div class="entry-summary">
    105123                                <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    … …  
    115133                                <?php if ( count( get_the_category() ) ) : ?>
    116134                                        <span class="cat-links">
    117                                                 <span class="entry-utility-prep entry-utility-prep-cat-links"><?php printf( __('Posted in %s', 'twentyten' ), '</span> '.get_the_category_list( ', ' ) ); ?>
     135                                                <span class="entry-utility-prep entry-utility-prep-cat-links"><?php printf( __('Posted in %s', 'twentyten' ), '</span> ' . get_the_category_list( ', ' ) ); ?>
    118136                                        </span>
    119137                                        <span class="meta-sep">|</span>
    … …  
    135153                <?php comments_template( '', true ); ?>
    136154
    137         <?php endif; // if different categories queried ?>
    138 <?php endwhile; ?>
     155        <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>
     156
     157<?php endwhile; // End the loop. Whew. ?>
    139158
    140159<?php /* Display navigation to next/previous pages when applicable */ ?>
Note: See TracChangeset for help on using the changeset viewer.