Ticket #15385: 15385.diff
File 15385.diff, 21.7 KB (added by , 14 years ago) |
---|
-
wp-content/themes/twentyten/post-format-gallery.php
1 1 <?php 2 2 /** 3 * The loop that displays posts.3 * The code that displays posts in the Gallery format. 4 4 * 5 * The loop displays the posts and the post content. See 6 * http://codex.wordpress.org/The_Loop to understand it and 7 * http://codex.wordpress.org/Template_Tags to understand 8 * the tags used in it. 5 * This code is executed within the loop. 9 6 * 10 * This can be overridden in child themes with loop.php or 11 * loop-template.php, where 'template' is the loop context 12 * requested by a template. For example, loop-index.php would 13 * be used if it exists and we ask for the loop with: 14 * <code>get_template_part( 'loop', 'index' );</code> 7 * This can be overridden in child themes with post-format-gallery.php, 8 * as this file is called in loop.php using get_template_part(): 9 * <code>get_template_part( 'post-format', 'gallery' );</code> 15 10 * 16 11 * @package WordPress 17 12 * @subpackage Twenty_Ten 18 * @since Twenty Ten 1. 013 * @since Twenty Ten 1.3 19 14 */ 20 15 ?> 21 16 22 <?php /* Display navigation to next/previous pages when applicable */ ?>23 <?php if ( $wp_query->max_num_pages > 1 ) : ?>24 <div id="nav-above" class="navigation">25 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>26 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>27 </div><!-- #nav-above -->28 <?php endif; ?>29 30 <?php /* If there are no posts to display, such as an empty archive page */ ?>31 <?php if ( ! have_posts() ) : ?>32 <div id="post-0" class="post error404 not-found">33 <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>34 <div class="entry-content">35 <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>36 <?php get_search_form(); ?>37 </div><!-- .entry-content -->38 </div><!-- #post-0 -->39 <?php endif; ?>40 41 <?php42 /* Start the Loop.43 *44 * In Twenty Ten we use the same loop in multiple contexts.45 * It is broken into three main parts: when we're displaying46 * posts that are in the gallery category, when we're displaying47 * posts in the asides category, and finally all other posts.48 *49 * Additionally, we sometimes check for whether we are on an50 * archive page, a search page, etc., allowing for small differences51 * in the loop on each template without actually duplicating52 * the rest of the loop that is shared.53 *54 * Without further ado, the loop:55 */ ?>56 <?php while ( have_posts() ) : the_post(); ?>57 58 <?php /* How to display posts in the Gallery category. */ ?>59 60 <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) || 'gallery' == get_post_format( $post->ID ) ) : ?>61 17 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 62 18 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 63 19 … … 94 50 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> 95 51 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 96 52 </div><!-- .entry-utility --> 97 </div><!-- #post-## --> 98 99 <?php /* How to display posts in the asides category */ ?> 100 101 <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) || 'aside' == get_post_format( $post->ID ) ) : ?> 102 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 103 104 <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?> 105 <div class="entry-summary"> 106 <?php the_excerpt(); ?> 107 </div><!-- .entry-summary --> 108 <?php else : ?> 109 <div class="entry-content"> 110 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?> 111 </div><!-- .entry-content --> 112 <?php endif; ?> 113 114 <div class="entry-utility"> 115 <?php twentyten_posted_on(); ?> 116 <span class="meta-sep">|</span> 117 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> 118 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 119 </div><!-- .entry-utility --> 120 </div><!-- #post-## --> 121 122 <?php /* How to display all other posts. */ ?> 123 124 <?php else : ?> 125 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 126 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 127 128 <div class="entry-meta"> 129 <?php twentyten_posted_on(); ?> 130 </div><!-- .entry-meta --> 131 132 <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?> 133 <div class="entry-summary"> 134 <?php the_excerpt(); ?> 135 </div><!-- .entry-summary --> 136 <?php else : ?> 137 <div class="entry-content"> 138 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?> 139 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?> 140 </div><!-- .entry-content --> 141 <?php endif; ?> 142 143 <div class="entry-utility"> 144 <?php if ( count( get_the_category() ) ) : ?> 145 <span class="cat-links"> 146 <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> 147 </span> 148 <span class="meta-sep">|</span> 149 <?php endif; ?> 150 <?php 151 $tags_list = get_the_tag_list( '', ', ' ); 152 if ( $tags_list ): 153 ?> 154 <span class="tag-links"> 155 <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> 156 </span> 157 <span class="meta-sep">|</span> 158 <?php endif; ?> 159 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> 160 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 161 </div><!-- .entry-utility --> 162 </div><!-- #post-## --> 163 164 <?php comments_template( '', true ); ?> 165 166 <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?> 167 168 <?php endwhile; // End the loop. Whew. ?> 169 170 <?php /* Display navigation to next/previous pages when applicable */ ?> 171 <?php if ( $wp_query->max_num_pages > 1 ) : ?> 172 <div id="nav-below" class="navigation"> 173 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> 174 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> 175 </div><!-- #nav-below --> 176 <?php endif; ?> 53 </div><!-- #post-## --> 54 No newline at end of file -
wp-content/themes/twentyten/loop.php
43 43 * 44 44 * In Twenty Ten we use the same loop in multiple contexts. 45 45 * It is broken into three main parts: when we're displaying 46 * posts that are in the gallery category, when we're displaying47 * posts in the asides category, and finally all other posts.46 * posts that are in the gallery format, when we're displaying 47 * posts in the asides format, and finally all other posts. 48 48 * 49 49 * Additionally, we sometimes check for whether we are on an 50 50 * archive page, a search page, etc., allowing for small differences … … 53 53 * 54 54 * Without further ado, the loop: 55 55 */ ?> 56 <?php while ( have_posts() ) : the_post(); ?>56 <?php 57 57 58 <?php /* How to display posts in the Gallery category. */ ?> 58 while ( have_posts() ) : the_post(); 59 59 60 <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) || 'gallery' == get_post_format( $post->ID ) ) : ?> 61 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 62 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 60 /* How to display posts with the Gallery format, introduced in WordPress 3.1. The gallery category is from WordPress 3.0. */ 63 61 64 <div class="entry-meta"> 65 <?php twentyten_posted_on(); ?> 66 </div><!-- .entry-meta --> 62 if ( get_post_format( 'gallery' ) || in_category( _x( 'gallery', 'gallery category slug', 'twentyten' ) ) ) : 67 63 68 <div class="entry-content"> 69 <?php if ( post_password_required() ) : ?> 70 <?php the_content(); ?> 71 <?php else : ?> 72 <?php 73 $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); 74 if ( $images ) : 75 $total_images = count( $images ); 76 $image = array_shift( $images ); 77 $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' ); 78 ?> 79 <div class="gallery-thumb"> 80 <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a> 81 </div><!-- .gallery-thumb --> 82 <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ), 83 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', 84 $total_images 85 ); ?></em></p> 86 <?php endif; ?> 87 <?php the_excerpt(); ?> 88 <?php endif; ?> 89 </div><!-- .entry-content --> 64 get_template_part( 'post-format', 'gallery' ); 90 65 91 <div class="entry-utility"> 92 <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a> 93 <span class="meta-sep">|</span> 94 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> 95 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 96 </div><!-- .entry-utility --> 97 </div><!-- #post-## --> 66 /* How to display posts with the Aside format, introduced in WordPress 3.1. The asides category is from WordPress 3.0. */ 98 67 99 <?php /* How to display posts in the asides category */ ?> 68 elseif ( has_post_format( 'aside' ) || in_category( _x('asides', 'asides category slug', 'twentyten') ) ) : 100 69 101 <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) || 'aside' == get_post_format( $post->ID ) ) : ?> 102 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 70 get_template_part( 'post-format', 'aside' ); 103 71 104 <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?> 105 <div class="entry-summary"> 106 <?php the_excerpt(); ?> 107 </div><!-- .entry-summary --> 108 <?php else : ?> 109 <div class="entry-content"> 110 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?> 111 </div><!-- .entry-content --> 112 <?php endif; ?> 72 /* How to display all other posts. */ 113 73 114 <div class="entry-utility"> 115 <?php twentyten_posted_on(); ?> 116 <span class="meta-sep">|</span> 117 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> 118 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 119 </div><!-- .entry-utility --> 120 </div><!-- #post-## --> 121 122 <?php /* How to display all other posts. */ ?> 123 124 <?php else : ?> 74 else : 75 ?> 125 76 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 126 77 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 127 78 … … 163 114 164 115 <?php comments_template( '', true ); ?> 165 116 166 <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?>117 <?php endif; // This was the if statement that broke the loop into three parts based on formats. ?> 167 118 168 119 <?php endwhile; // End the loop. Whew. ?> 169 120 -
wp-content/themes/twentyten/post-format-aside.php
1 1 <?php 2 2 /** 3 * The loop that displays posts.3 * The code that displays posts in the Aside format. 4 4 * 5 * The loop displays the posts and the post content. See 6 * http://codex.wordpress.org/The_Loop to understand it and 7 * http://codex.wordpress.org/Template_Tags to understand 8 * the tags used in it. 5 * This code is executed within the loop. 9 6 * 10 * This can be overridden in child themes with loop.php or 11 * loop-template.php, where 'template' is the loop context 12 * requested by a template. For example, loop-index.php would 13 * be used if it exists and we ask for the loop with: 14 * <code>get_template_part( 'loop', 'index' );</code> 7 * This can be overridden in child themes with post-format-aside.php, 8 * as this file is called in loop.php using get_template_part(): 9 * <code>get_template_part( 'post-format', 'aside' );</code> 15 10 * 16 11 * @package WordPress 17 12 * @subpackage Twenty_Ten 18 * @since Twenty Ten 1. 013 * @since Twenty Ten 1.3 19 14 */ 20 15 ?> 21 16 22 <?php /* Display navigation to next/previous pages when applicable */ ?>23 <?php if ( $wp_query->max_num_pages > 1 ) : ?>24 <div id="nav-above" class="navigation">25 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>26 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>27 </div><!-- #nav-above -->28 <?php endif; ?>29 30 <?php /* If there are no posts to display, such as an empty archive page */ ?>31 <?php if ( ! have_posts() ) : ?>32 <div id="post-0" class="post error404 not-found">33 <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>34 <div class="entry-content">35 <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>36 <?php get_search_form(); ?>37 </div><!-- .entry-content -->38 </div><!-- #post-0 -->39 <?php endif; ?>40 41 <?php42 /* Start the Loop.43 *44 * In Twenty Ten we use the same loop in multiple contexts.45 * It is broken into three main parts: when we're displaying46 * posts that are in the gallery category, when we're displaying47 * posts in the asides category, and finally all other posts.48 *49 * Additionally, we sometimes check for whether we are on an50 * archive page, a search page, etc., allowing for small differences51 * in the loop on each template without actually duplicating52 * the rest of the loop that is shared.53 *54 * Without further ado, the loop:55 */ ?>56 <?php while ( have_posts() ) : the_post(); ?>57 58 <?php /* How to display posts in the Gallery category. */ ?>59 60 <?php if ( in_category( _x('gallery', 'gallery category slug', 'twentyten') ) || 'gallery' == get_post_format( $post->ID ) ) : ?>61 17 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 62 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>63 18 64 <div class="entry-meta">65 <?php twentyten_posted_on(); ?>66 </div><!-- .entry-meta -->67 68 <div class="entry-content">69 <?php if ( post_password_required() ) : ?>70 <?php the_content(); ?>71 <?php else : ?>72 <?php73 $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );74 if ( $images ) :75 $total_images = count( $images );76 $image = array_shift( $images );77 $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );78 ?>79 <div class="gallery-thumb">80 <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>81 </div><!-- .gallery-thumb -->82 <p><em><?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten' ),83 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',84 $total_images85 ); ?></em></p>86 <?php endif; ?>87 <?php the_excerpt(); ?>88 <?php endif; ?>89 </div><!-- .entry-content -->90 91 <div class="entry-utility">92 <a href="<?php echo get_term_link( _x('gallery', 'gallery category slug', 'twentyten'), 'category' ); ?>" title="<?php esc_attr_e( 'View posts in the Gallery category', 'twentyten' ); ?>"><?php _e( 'More Galleries', 'twentyten' ); ?></a>93 <span class="meta-sep">|</span>94 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>95 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>96 </div><!-- .entry-utility -->97 </div><!-- #post-## -->98 99 <?php /* How to display posts in the asides category */ ?>100 101 <?php elseif ( in_category( _x('asides', 'asides category slug', 'twentyten') ) || 'aside' == get_post_format( $post->ID ) ) : ?>102 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>103 104 19 <?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?> 105 20 <div class="entry-summary"> 106 21 <?php the_excerpt(); ?> … … 117 32 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> 118 33 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 119 34 </div><!-- .entry-utility --> 120 </div><!-- #post-## --> 121 122 <?php /* How to display all other posts. */ ?> 123 124 <?php else : ?> 125 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 126 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 127 128 <div class="entry-meta"> 129 <?php twentyten_posted_on(); ?> 130 </div><!-- .entry-meta --> 131 132 <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?> 133 <div class="entry-summary"> 134 <?php the_excerpt(); ?> 135 </div><!-- .entry-summary --> 136 <?php else : ?> 137 <div class="entry-content"> 138 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?> 139 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?> 140 </div><!-- .entry-content --> 141 <?php endif; ?> 142 143 <div class="entry-utility"> 144 <?php if ( count( get_the_category() ) ) : ?> 145 <span class="cat-links"> 146 <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> 147 </span> 148 <span class="meta-sep">|</span> 149 <?php endif; ?> 150 <?php 151 $tags_list = get_the_tag_list( '', ', ' ); 152 if ( $tags_list ): 153 ?> 154 <span class="tag-links"> 155 <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> 156 </span> 157 <span class="meta-sep">|</span> 158 <?php endif; ?> 159 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> 160 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 161 </div><!-- .entry-utility --> 162 </div><!-- #post-## --> 163 164 <?php comments_template( '', true ); ?> 165 166 <?php endif; // This was the if statement that broke the loop into three parts based on categories. ?> 167 168 <?php endwhile; // End the loop. Whew. ?> 169 170 <?php /* Display navigation to next/previous pages when applicable */ ?> 171 <?php if ( $wp_query->max_num_pages > 1 ) : ?> 172 <div id="nav-below" class="navigation"> 173 <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> 174 <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> 175 </div><!-- #nav-below --> 176 <?php endif; ?> 35 </div><!-- #post-## --> 36 No newline at end of file