Changeset 43571 for trunk/src/wp-content/themes/twentyeleven/showcase.php
- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyeleven/showcase.php
r42343 r43571 29 29 ?> 30 30 31 <?php31 <?php 32 32 /* 33 33 * We are using a heading by rendering the_content 34 34 * If we have content for this page, let's display it. 35 35 */ 36 if ( '' != get_the_content() ) {37 get_template_part( 'content', 'intro' );38 }39 ?>36 if ( '' != get_the_content() ) { 37 get_template_part( 'content', 'intro' ); 38 } 39 ?> 40 40 41 41 <?php endwhile; ?> … … 78 78 $header_image_width = HEADER_IMAGE_WIDTH; 79 79 } 80 ?>80 ?> 81 81 82 82 <div class="featured-posts"> 83 83 <h1 class="showcase-heading"><?php _e( 'Featured Post', 'twentyeleven' ); ?></h1> 84 84 85 <?php86 // Let's roll.87 while ( $featured->have_posts() ) :88 $featured->the_post();89 90 // Increase the counter.91 $counter_slider++;92 93 /*94 * We're going to add a class to our featured post for featured images95 * by default it'll have the feature-text class.96 */97 $feature_class = 'feature-text';98 99 if ( has_post_thumbnail() ) {100 // ... but if it has a featured image let's add some class101 $feature_class = 'feature-image small';102 103 // Hang on. Let's check this here image out.104 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) );105 106 // Is it bigger than or equal to our header?107 if ( $image[1] >= $header_image_width ) {108 // If bigger, let's add a BIGGER class. It's EXTRA classy now.109 $feature_class = 'feature-image large';110 }111 }112 ?>85 <?php 86 // Let's roll. 87 while ( $featured->have_posts() ) : 88 $featured->the_post(); 89 90 // Increase the counter. 91 $counter_slider++; 92 93 /* 94 * We're going to add a class to our featured post for featured images 95 * by default it'll have the feature-text class. 96 */ 97 $feature_class = 'feature-text'; 98 99 if ( has_post_thumbnail() ) { 100 // ... but if it has a featured image let's add some class 101 $feature_class = 'feature-image small'; 102 103 // Hang on. Let's check this here image out. 104 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ); 105 106 // Is it bigger than or equal to our header? 107 if ( $image[1] >= $header_image_width ) { 108 // If bigger, let's add a BIGGER class. It's EXTRA classy now. 109 $feature_class = 'feature-image large'; 110 } 111 } 112 ?> 113 113 114 114 <section class="featured-post <?php echo esc_attr( $feature_class ); ?>" id="featured-post-<?php echo esc_attr( $counter_slider ); ?>"> 115 115 116 <?php117 /*118 * If the thumbnail is as big as the header image119 * make it a large featured post, otherwise render it small120 */121 if ( has_post_thumbnail() ) {122 if ( $image[1] >= $header_image_width ) {123 $thumbnail_size = 'large-feature';124 } else {125 $thumbnail_size = 'small-feature';126 }127 ?>116 <?php 117 /* 118 * If the thumbnail is as big as the header image 119 * make it a large featured post, otherwise render it small 120 */ 121 if ( has_post_thumbnail() ) { 122 if ( $image[1] >= $header_image_width ) { 123 $thumbnail_size = 'large-feature'; 124 } else { 125 $thumbnail_size = 'small-feature'; 126 } 127 ?> 128 128 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_post_thumbnail( $thumbnail_size ); ?></a> 129 <?php130 }131 ?>132 <?php get_template_part( 'content', 'featured' ); ?>129 <?php 130 } 131 ?> 132 <?php get_template_part( 'content', 'featured' ); ?> 133 133 </section> 134 <?php endwhile; ?>135 136 <?php137 // Show slider only if we have more than one featured post.138 if ( $featured->post_count > 1 ) :139 ?>134 <?php endwhile; ?> 135 136 <?php 137 // Show slider only if we have more than one featured post. 138 if ( $featured->post_count > 1 ) : 139 ?> 140 140 <nav class="feature-slider"> 141 141 <ul> 142 <?php143 144 // Reset the counter so that we end up with matching elements145 $counter_slider = 0;146 147 // Begin from zero148 rewind_posts();149 150 // Let's roll again.151 while ( $featured->have_posts() ) :152 $featured->the_post();153 $counter_slider++;154 if ( 1 == $counter_slider ) {155 $class = ' class="active"';156 } else {157 $class = '';158 }159 ?>142 <?php 143 144 // Reset the counter so that we end up with matching elements 145 $counter_slider = 0; 146 147 // Begin from zero 148 rewind_posts(); 149 150 // Let's roll again. 151 while ( $featured->have_posts() ) : 152 $featured->the_post(); 153 $counter_slider++; 154 if ( 1 == $counter_slider ) { 155 $class = ' class="active"'; 156 } else { 157 $class = ''; 158 } 159 ?> 160 160 <li><a href="#featured-post-<?php echo esc_attr( $counter_slider ); ?>" title="<?php echo esc_attr( sprintf( __( 'Featuring: %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ); ?>"<?php echo $class; ?>></a></li> 161 <?php endwhile; ?>161 <?php endwhile; ?> 162 162 </ul> 163 163 </nav> … … 207 207 while ( $recent->have_posts() ) : 208 208 $recent->the_post(); 209 ?>209 ?> 210 210 211 211 <li class="entry-title"> … … 216 216 </li> 217 217 218 <?php218 <?php 219 219 endwhile; 220 220 … … 231 231 <?php 232 232 the_widget( 233 'Twenty_Eleven_Ephemera_Widget', '', array( 233 'Twenty_Eleven_Ephemera_Widget', 234 '', 235 array( 234 236 'before_title' => '<h3 class="widget-title">', 235 237 'after_title' => '</h3>',
Note: See TracChangeset
for help on using the changeset viewer.