WordPress.org

Make WordPress Core

Changeset 17802


Ignore:
Timestamp:
05/04/2011 10:54:50 PM (9 years ago)
Author:
lancewillett
Message:

Twenty Eleven updates and fixes, see #17198

  • Add explanatory comments in all templates, following Twenty Ten's example
  • Stick with twentyeleven_ for prefixing filter names
  • Use post format content templates in search results
  • First pass at adding a template for adding a sidebar to pages
  • Add a featured post header to standard sticky posts
  • Style fixes: print media, comment styles for pages with sidebars, color of meta links on image post format
Location:
trunk/wp-content/themes/twentyeleven
Files:
2 added
13 edited

Legend:

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

    r17787 r17802  
    1818            <div id="content" role="main">
    1919
    20                 <?php the_post(); ?>
     20                <?php
     21                    /* Queue the first post, that way we know
     22                     * what date we're dealing with (if that is the case).
     23                     *
     24                     * We reset this later so we can run the loop
     25                     * properly with a call to rewind_posts().
     26                     */
     27                    if ( have_posts() )
     28                        the_post();
     29                ?>
    2130
    2231                <header class="page-header">
     
    3443                </header>
    3544
    36                 <?php rewind_posts(); ?>
     45                <?php
     46                    /* Since we called the_post() above, we need to
     47                     * rewind the loop back to the beginning that way
     48                     * we can run the loop properly, in full.
     49                     */
     50                    rewind_posts();
     51                ?>
    3752
    3853                <?php twentyeleven_content_nav( 'nav-above' ); ?>
     
    4156                <?php while ( have_posts() ) : the_post(); ?>
    4257
    43                     <?php get_template_part( 'content', get_post_format() ); ?>
     58                    <?php
     59                        /* Include the Post-Format-specific template for the content.
     60                         * If you want to overload this in a child theme then include a file
     61                         * called loop-___.php (where ___ is the Post Format name) and that will be used instead.
     62                         */
     63                        get_template_part( 'content', get_post_format() );
     64                    ?>
    4465
    4566                <?php endwhile; ?>
  • trunk/wp-content/themes/twentyeleven/author.php

    r17787 r17802  
    1313            <div id="content" role="main">
    1414
    15                 <?php the_post(); ?>
     15                <?php
     16                    /* Queue the first post, that way we know
     17                     * what date we're dealing with (if that is the case).
     18                     *
     19                     * We reset this later so we can run the loop
     20                     * properly with a call to rewind_posts().
     21                     */
     22                    if ( have_posts() )
     23                        the_post();
     24                ?>
    1625
    1726                <header class="page-header">
     
    1928                </header>
    2029
    21                 <?php rewind_posts(); ?>
     30                <?php
     31                    /* Since we called the_post() above, we need to
     32                     * rewind the loop back to the beginning that way
     33                     * we can run the loop properly, in full.
     34                     */
     35                    rewind_posts();
     36                ?>
    2237
    2338                <?php twentyeleven_content_nav( 'nav-above' ); ?>
     
    4055                <?php while ( have_posts() ) : the_post(); ?>
    4156
    42                     <?php get_template_part( 'content', get_post_format() ); ?>
     57                    <?php
     58                        /* Include the Post-Format-specific template for the content.
     59                         * If you want to overload this in a child theme then include a file
     60                         * called loop-___.php (where ___ is the Post Format name) and that will be used instead.
     61                         */
     62                        get_template_part( 'content', get_post_format() );
     63                    ?>
    4364
    4465                <?php endwhile; ?>
  • trunk/wp-content/themes/twentyeleven/category.php

    r17787 r17802  
    2626                <?php while ( have_posts() ) : the_post(); ?>
    2727
    28                     <?php get_template_part( 'content', get_post_format() ); ?>
     28                    <?php
     29                        /* Include the Post-Format-specific template for the content.
     30                         * If you want to overload this in a child theme then include a file
     31                         * called loop-___.php (where ___ is the Post Format name) and that will be used instead.
     32                         */
     33                        get_template_part( 'content', get_post_format() );
     34                    ?>
    2935
    3036                <?php endwhile; ?>
  • trunk/wp-content/themes/twentyeleven/comments.php

    r17787 r17802  
    1717        <div class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyeleven' ); ?></div>
    1818    </div><!-- .comments -->
    19     <?php return;
     19    <?php
     20            /* Stop the rest of comments.php from being processed,
     21             * but don't kill the script entirely -- we still have
     22             * to fully load the template.
     23             */
     24            return;
    2025        endif;
    2126    ?>
     
    4045
    4146        <ol class="commentlist">
    42             <?php wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) ); ?>
     47            <?php
     48                /* Loop through and list the comments. Tell wp_list_comments()
     49                 * to use twentyeleven_comment() to format the comments.
     50                 * If you want to overload this in a child theme then you can
     51                 * define twentyeleven_comment() and that will be used instead.
     52                 * See twentyeleven_comment() in twentyeleven/functions.php for more.
     53                 */
     54                wp_list_comments( array( 'callback' => 'twentyeleven_comment' ) );
     55            ?>
    4356        </ol>
    4457
  • trunk/wp-content/themes/twentyeleven/content.php

    r17791 r17802  
    1111    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1212        <header class="entry-header">
     13            <?php if ( is_sticky() ) : ?>
     14                <hgroup>
     15                    <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
     16                    <h2 class="entry-format"><?php _e( 'Featured', 'twentyeleven' ); ?></h2>
     17                </hgroup>
     18            <?php else : ?>
    1319            <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
     20            <?php endif; ?>
    1421
    1522            <?php if ( 'post' == $post->post_type ) : ?>
  • trunk/wp-content/themes/twentyeleven/footer.php

    r17787 r17802  
    1515    <footer id="colophon" role="contentinfo">
    1616
    17             <?php if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) ) : ?>
    18             <div id="supplementary" <?php twentyeleven_footer_sidebar_class(); ?>>
    19                 <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?>
    20                 <div id="first" class="widget-area" role="complementary">
    21                     <?php dynamic_sidebar( 'sidebar-3' ); ?>
    22                 </div><!-- #first .widget-area -->
    23                 <?php endif; ?>
    24 
    25                 <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?>
    26                 <div id="second" class="widget-area" role="complementary">
    27                     <?php dynamic_sidebar( 'sidebar-4' ); ?>
    28                 </div><!-- #second .widget-area -->
    29                 <?php endif; ?>
    30 
    31                 <?php if ( is_active_sidebar( 'sidebar-5' ) ) : ?>
    32                 <div id="third" class="widget-area" role="complementary">
    33                     <?php dynamic_sidebar( 'sidebar-5' ); ?>
    34                 </div><!-- #third .widget-area -->
    35                 <?php endif; ?>
    36             </div><!-- #supplementary -->
    37             <?php endif; ?>
     17            <?php
     18                /* A sidebar in the footer? Yep. You can can customize
     19                 * your footer with three columns of widgets.
     20                 */
     21                get_sidebar( 'footer' );
     22            ?>
    3823
    3924            <div id="site-generator">
  • trunk/wp-content/themes/twentyeleven/functions.php

    r17790 r17802  
    354354 */
    355355function twentyeleven_singular_class( $classes ) {
    356     if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) )
     356    if ( is_singular() && ! is_home() && ! is_page_template( 'showcase.php' ) && ! is_page_template( 'sidebar-page.php' ) )
    357357        $classes[] = 'singular';
    358358
  • trunk/wp-content/themes/twentyeleven/header.php

    r17787 r17802  
    4848<link rel="profile" href="http://gmpg.org/xfn/11" />
    4949<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    50 <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
    5150<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    5251<!--[if lt IE 9]>
    5352<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
    5453<![endif]-->
     54<?php
     55    /* We add some JavaScript to pages with the comment form
     56     * to support sites with threaded comments (when in use).
     57     */
     58    if ( is_singular() && get_option( 'thread_comments' ) )
     59        wp_enqueue_script( 'comment-reply' );
    5560
    56 <?php wp_head(); ?>
     61    /* Always have wp_head() just before the closing </head>
     62     * tag of your theme, or you will break many plugins, which
     63     * generally use this hook to add elements to <head> such
     64     * as styles, scripts, and meta tags.
     65     */
     66    wp_head();
     67?>
    5768</head>
    5869
     
    101112            <nav id="access" role="navigation">
    102113                <h1 class="section-heading"><?php _e( 'Main menu', 'twentyeleven' ); ?></h1>
     114                <?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
    103115                <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyeleven' ); ?>"><?php _e( 'Skip to content', 'twentyeleven' ); ?></a></div>
    104 
     116                <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
    105117                <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
    106118            </nav><!-- #access -->
  • trunk/wp-content/themes/twentyeleven/image.php

    r17787 r17802  
    7171?>
    7272                                <a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
    73                                 $attachment_size = apply_filters( 'theme_attachment_size', 848 );
     73                                $attachment_size = apply_filters( 'twentyeleven_attachment_size', 848 );
    7474                                echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height.
    7575                                ?></a>
  • trunk/wp-content/themes/twentyeleven/inc/theme-options.php

    r17755 r17802  
    296296        .widget_twentyeleven_ephemera .comments-link a:hover,
    297297        section.recent-posts .other-recent-posts a[rel="bookmark"]:hover,
    298         section.recent-posts .other-recent-posts .comments-link a:hover {
     298        section.recent-posts .other-recent-posts .comments-link a:hover,
     299        .format-image footer.entry-meta a:hover {
    299300            color: <?php echo $link_color; ?>;
    300301        }
  • trunk/wp-content/themes/twentyeleven/search.php

    r17787 r17802  
    2424                <?php while ( have_posts() ) : the_post(); ?>
    2525
    26                     <?php get_template_part( 'content', 'search' ); ?>
     26                    <?php
     27                        /* Include the Post-Format-specific template for the content.
     28                         * If you want to overload this in a child theme then include a file
     29                         * called loop-___.php (where ___ is the Post Format name) and that will be used instead.
     30                         */
     31                        get_template_part( 'content', get_post_format() );
     32                    ?>
    2733
    2834                <?php endwhile; ?>
  • trunk/wp-content/themes/twentyeleven/style.css

    r17791 r17802  
    10531053    display: block;
    10541054}
     1055.format-image footer.entry-meta a {
     1056    color: #444;
     1057}
    10551058.format-image .wp-caption {
    10561059    background: #111;
     
    17781781    background: #ddd;
    17791782    border-color: #d3d3d3;
     1783}
     1784
     1785/* sidebar-page.php comments */
     1786/* Make sure we have room for our comment avatars */
     1787.page-template-sidebar-page-php .commentlist > li.comment,
     1788.page-template-sidebar-page-php.commentlist .pingback {
     1789    margin-left: 102px;
     1790    width: auto;
     1791}
     1792/* And a full-width comment form */
     1793.page-template-sidebar-page-php #respond {
     1794    width: auto;
    17801795}
    17811796
     
    21152130    .commentlist > li.comment,
    21162131    .commentlist > li.pingback {
    2117         margin-left: 0;
     2132        margin-left: 0 !important;
    21182133    }
    21192134    .commentlist .avatar {
     
    21472162    }
    21482163    footer.entry-meta a[rel=bookmark]:link:after,
    2149     footer.entry-meta a[rel=bookmark]:visited:after,
    2150     #author-info a:link:after,
    2151     #author-info a:visited:after {
     2164    footer.entry-meta a[rel=bookmark]:visited:after {
    21522165        content:" [" attr(href) "] "; /* Show URLs */
    21532166    }   
     
    22002213    .singular .entry-header .entry-meta {
    22012214        position: static;
     2215    }
     2216    .entry-meta .edit-link a {
     2217        display: none;
    22022218    }
    22032219    #content nav {
     
    22712287        margin: 1.625em 0 0;
    22722288    }
     2289    .commentlist .comment-edit-link {
     2290        display: none;
     2291    }
     2292    .commentlist > li::before,
     2293    .commentlist > li.bypostauthor::before {
     2294        content: '';
     2295    }
     2296    .commentlist .reply {
     2297        display: none;
     2298    }
    22732299   
    22742300    /* Post author highlighting */
  • trunk/wp-content/themes/twentyeleven/tag.php

    r17787 r17802  
    2828                <?php while ( have_posts() ) : the_post(); ?>
    2929
    30                     <?php get_template_part( 'content', get_post_format() ); ?>
     30                    <?php
     31                        /* Include the Post-Format-specific template for the content.
     32                         * If you want to overload this in a child theme then include a file
     33                         * called loop-___.php (where ___ is the Post Format name) and that will be used instead.
     34                         */
     35                        get_template_part( 'content', get_post_format() );
     36                    ?>
    3137
    3238                <?php endwhile; ?>
Note: See TracChangeset for help on using the changeset viewer.