Changeset 18269
- Timestamp:
- 06/11/2011 05:07:18 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/showcase.php
r18266 r18269 79 79 /** 80 80 * We're going to add a class to our featured post for featured images 81 * by default it'll have no class though.82 */ 83 $feature_class = ' ';81 * by default it'll have the feature-text class. 82 */ 83 $feature_class = 'feature-text'; 84 84 85 85 if ( has_post_thumbnail() ) { … … 95 95 $feature_class = 'feature-image large'; 96 96 } 97 } else {98 $feature_class = 'feature-text';99 97 } 100 ?>101 102 <?php if ( has_post_thumbnail() ) : ?>103 <section class="featured-post <?php echo $feature_class; ?>" id="featured-post-<?php echo $counter_slider; ?>">104 <?php else : ?>105 <section class="featured-post" id="featured-post-<?php echo $counter_slider; ?>">106 <?php endif; ?>107 108 <?php109 /**110 * If the thumbnail is as big as the header image111 * make it a large featured post, otherwise render it small112 */113 if ( has_post_thumbnail() ) {114 if ( $image[1] >= HEADER_IMAGE_WIDTH ) { ?>115 <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"> <?php the_post_thumbnail( 'large-feature' ); ?></a>116 <?php } else { ?>117 <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'small-feature' ); ?></a>118 <?php }119 }120 98 ?> 121 <?php get_template_part( 'content', 'featured' ); ?> 122 </section> 99 100 <section class="featured-post <?php echo $feature_class; ?>" id="featured-post-<?php echo $counter_slider; ?>"> 101 102 <?php 103 /** 104 * If the thumbnail is as big as the header image 105 * make it a large featured post, otherwise render it small 106 */ 107 if ( has_post_thumbnail() ) { 108 if ( $image[1] >= HEADER_IMAGE_WIDTH ) 109 $thumbnail_size = 'large-feature'; 110 else 111 $thumbnail_size = 'small-feature'; 112 ?> 113 <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail( $thumbnail_size ); ?></a> 114 <?php 115 } 116 ?> 117 <?php get_template_part( 'content', 'featured' ); ?> 118 </section> 123 119 <?php endwhile; ?> 124 120 … … 130 126 <ul> 131 127 <?php 132 /**133 * We need to query the same set of posts again134 * to populate the navigation dots135 */136 $featured->query( $featured_args );137 128 138 129 // Reset the counter so that we end up with matching elements … … 145 136 while ( $featured->have_posts() ) : $featured->the_post(); 146 137 $counter_slider++; 147 ?>148 <li><a href="#featured-post-<?php echo $counter_slider; ?>" title="<?php printf( esc_attr__( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" <?php149 if ( 1 == $counter_slider ) :150 echo 'class="active"';151 endif;152 ?>></a></li>138 if ( 1 == $counter_slider ) 139 $class = 'class="active"'; 140 else 141 $class = ''; 142 ?> 143 <li><a href="#featured-post-<?php echo $counter_slider; ?>" title="<?php printf( esc_attr__( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" <?php echo $class; ?>></a></li> 153 144 <?php endwhile; ?> 154 145 </ul> … … 178 169 'no_found_rows' => true, 179 170 ); 171 180 172 // Our new query for the Recent Posts section. 181 173 $recent = new WP_Query( $recent_args ); 182 $counter = 0; 183 184 while ( $recent->have_posts() ) : $recent->the_post(); 174 175 // The first Recent post is displayed normally 176 if ( $recent->have_posts() ) : $recent->the_post(); 177 185 178 // Set $more to 0 in order to only get the first part of the post. 186 179 global $more; 187 180 $more = 0; 188 $counter++; 189 190 if ( 1 == $counter ) : 191 get_template_part( 'content', get_post_format() ); 192 echo '<ol class="other-recent-posts">'; 193 194 else : ?> 195 <li class="entry-title"> 196 <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> 197 <span class="comments-link"> 198 <?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?> 199 </span> 200 </li> 201 202 <?php endif; 181 182 get_template_part( 'content', get_post_format() ); 183 184 echo '<ol class="other-recent-posts">'; 185 186 endif; 187 188 // For all other recent posts, just display the title and comment status. 189 while ( $recent->have_posts() ) : $recent->the_post(); ?> 190 191 <li class="entry-title"> 192 <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> 193 <span class="comments-link"> 194 <?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?> 195 </span> 196 </li> 197 198 <?php 203 199 endwhile; 200 201 // If we had some posts, close the <ol> 202 if ( $recent->post_count > 0 ) 203 echo '</ol>'; 204 204 ?> 205 206 </ol>207 205 </section><!-- .recent-posts --> 208 206
Note: See TracChangeset
for help on using the changeset viewer.