Ticket #17198: 17198.whitespace-newlines.diff
| File 17198.whitespace-newlines.diff, 47.8 KB (added by , 15 years ago) |
|---|
-
wp-content/themes/twentyeleven/author.php
31 31 <?php the_author_meta( 'description' ); ?> 32 32 </div><!-- #author-description --> 33 33 </div><!-- #entry-author-info --> 34 <?php endif; ?> 34 <?php endif; ?> 35 35 36 36 <?php /* Start the Loop */ ?> 37 37 <?php while ( have_posts() ) : the_post(); ?> -
wp-content/themes/twentyeleven/content-aside.php
11 11 12 12 <?php if ( 'post' == $post->post_type ) : ?> 13 13 <?php endif; ?> 14 14 15 15 <?php if ( comments_open() ) : ?> 16 16 <div class="comments-link"> 17 17 <?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?> … … 47 47 <?php endif; ?> 48 48 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 49 49 </footer><!-- #entry-meta --> 50 </article><!-- #post-<?php the_ID(); ?> --> 50 </article><!-- #post-<?php the_ID(); ?> --> 51 No newline at end of file -
wp-content/themes/twentyeleven/content-featured.php
48 48 49 49 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 50 50 </footer><!-- .entry-meta --> 51 </article><!-- #post-<?php the_ID(); ?> --> 51 </article><!-- #post-<?php the_ID(); ?> --> 52 No newline at end of file -
wp-content/themes/twentyeleven/content-gallery.php
31 31 <div class="entry-content"> 32 32 <?php if ( post_password_required() ) : ?> 33 33 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?> 34 34 35 35 <?php else : ?> 36 36 <?php 37 37 $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); … … 44 44 <figure class="gallery-thumb"> 45 45 <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a> 46 46 </figure><!-- .gallery-thumb --> 47 47 48 48 <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyeleven' ), 49 49 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', 50 50 number_format_i18n( $total_images ) … … 63 63 <span class="comments-link"><?php comments_popup_link( __( 'Leave a reply', 'twentyeleven' ), __( '1 reply', 'twentyeleven' ), __( '% replies', 'twentyeleven' ) ); ?></span> 64 64 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 65 65 </footer><!-- #entry-meta --> 66 </article><!-- #post-<?php the_ID(); ?> --> 66 </article><!-- #post-<?php the_ID(); ?> --> 67 No newline at end of file -
wp-content/themes/twentyeleven/content-intro.php
15 15 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyeleven' ), 'after' => '</div>' ) ); ?> 16 16 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 17 17 </div><!-- .entry-content --> 18 </article><!-- #post-<?php the_ID(); ?> --> 18 </article><!-- #post-<?php the_ID(); ?> --> 19 No newline at end of file -
wp-content/themes/twentyeleven/content-link.php
11 11 12 12 <?php if ( 'post' == $post->post_type ) : ?> 13 13 <?php endif; ?> 14 14 15 15 <?php if ( comments_open() ) : ?> 16 16 <div class="comments-link"> 17 17 <?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?> … … 47 47 <?php endif; ?> 48 48 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 49 49 </footer><!-- #entry-meta --> 50 </article><!-- #post-<?php the_ID(); ?> --> 50 </article><!-- #post-<?php the_ID(); ?> --> 51 No newline at end of file -
wp-content/themes/twentyeleven/content-page.php
15 15 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyeleven' ), 'after' => '</div>' ) ); ?> 16 16 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 17 17 </div><!-- .entry-content --> 18 </article><!-- #post-<?php the_ID(); ?> --> 18 </article><!-- #post-<?php the_ID(); ?> --> 19 No newline at end of file -
wp-content/themes/twentyeleven/content-single.php
28 28 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( '<span>Pages:</span>', 'twentyeleven' ), 'after' => '</div>' ) ); ?> 29 29 </div><!-- .entry-content --> 30 30 31 <footer class="entry-meta"> 31 <footer class="entry-meta"> 32 32 <?php 33 33 $tag_list = get_the_tag_list( '', ', ' ); 34 34 if ( '' != $tag_list ) { … … 47 47 ); 48 48 ?> 49 49 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 50 50 51 51 <?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries ?> 52 52 <div id="author-info"> 53 53 <div id="author-avatar"> … … 65 65 </div><!-- #entry-author-info --> 66 66 <?php endif; ?> 67 67 </footer><!-- .entry-meta --> 68 </article><!-- #post-<?php the_ID(); ?> --> 68 </article><!-- #post-<?php the_ID(); ?> --> 69 No newline at end of file -
wp-content/themes/twentyeleven/content.php
23 23 ?> 24 24 </div><!-- .entry-meta --> 25 25 <?php endif; ?> 26 26 27 27 <?php if ( comments_open() ) : ?> 28 28 <div class="comments-link"> 29 29 <?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?> … … 47 47 <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyeleven' ); ?></span><?php the_category( ', ' ); ?></span> 48 48 <?php the_tags( '<span class="sep"> | </span><span class="tag-links">' . __( 'Tagged ', 'twentyeleven' ) . '</span>', ', ', '' ); ?> 49 49 <?php endif; ?> 50 50 51 51 <?php if ( comments_open() ) : ?> 52 52 <span class="sep"> | </span> 53 53 <span class="comments-link"><?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span> 54 54 <?php endif; ?> 55 55 56 56 <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> 57 57 </footer><!-- #entry-meta --> 58 </article><!-- #post-<?php the_ID(); ?> --> 58 </article><!-- #post-<?php the_ID(); ?> --> 59 No newline at end of file -
wp-content/themes/twentyeleven/footer.php
8 8 </div><!-- #main --> 9 9 10 10 <footer id="colophon" role="contentinfo"> 11 11 12 12 <?php if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) ) : ?> 13 13 <div id="supplementary" <?php twentyeleven_footer_sidebar_class(); ?>> 14 14 <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?> 15 15 <div id="first" class="widget-area" role="complementary"> 16 16 <?php dynamic_sidebar( 'sidebar-3' ); ?> 17 17 </div><!-- #first .widget-area --> 18 <?php endif; ?> 18 <?php endif; ?> 19 19 20 20 <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?> 21 21 <div id="second" class="widget-area" role="complementary"> 22 22 <?php dynamic_sidebar( 'sidebar-4' ); ?> 23 23 </div><!-- #second .widget-area --> 24 <?php endif; ?> 24 <?php endif; ?> 25 25 26 26 <?php if ( is_active_sidebar( 'sidebar-5' ) ) : ?> 27 27 <div id="third" class="widget-area" role="complementary"> 28 28 <?php dynamic_sidebar( 'sidebar-5' ); ?> 29 29 </div><!-- #third .widget-area --> 30 <?php endif; ?> 30 <?php endif; ?> 31 31 </div><!-- #supplementary --> 32 32 <?php endif; ?> 33 33 34 34 <div id="site-generator"> 35 35 <a href="http://wordpress.org/" rel="generator">Proudly powered by WordPress</a><span class="sep"> | </span><?php printf( __( 'Theme: %1$s.', 'twentyeleven' ), 'Twenty Eleven' ); ?> 36 36 </div> -
wp-content/themes/twentyeleven/functions.php
285 285 'before_title' => '<h1 class="widget-title">', 286 286 'after_title' => '</h1>', 287 287 ) ); 288 288 289 289 register_sidebar( array( 290 290 'name' => __( 'Footer Area Two', 'twentyeleven' ), 291 291 'id' => 'sidebar-4', … … 295 295 'before_title' => '<h1 class="widget-title">', 296 296 'after_title' => '</h1>', 297 297 ) ); 298 298 299 299 register_sidebar( array( 300 300 'name' => __( 'Footer Area Three', 'twentyeleven' ), 301 301 'id' => 'sidebar-5', … … 305 305 'before_title' => '<h1 class="widget-title">', 306 306 'after_title' => '</h1>', 307 307 ) ); 308 308 309 309 } 310 310 add_action( 'init', 'twentyeleven_widgets_init' ); 311 311 … … 355 355 */ 356 356 function twentyeleven_footer_sidebar_class() { 357 357 $count = 0; 358 358 359 359 if ( is_active_sidebar( 'sidebar-3' ) ) 360 360 $count++; 361 361 … … 364 364 365 365 if ( is_active_sidebar( 'sidebar-5' ) ) 366 366 $count++; 367 367 368 368 switch ( $count ) { 369 369 case '1': 370 370 $class = 'one'; … … 377 377 case '3': 378 378 $class = 'three'; 379 379 break; 380 380 381 381 default: 382 382 $class = ''; 383 383 break; 384 384 } 385 385 386 386 if ( '' != $class ) 387 387 echo 'class="' . $class . '"'; 388 388 } … … 411 411 $avatar_size = 68; 412 412 if ( '0' != $comment->comment_parent ) 413 413 $avatar_size = 39; 414 414 415 415 echo get_avatar( $comment, $avatar_size ); 416 416 417 417 printf( __( '%1$s on %2$s%3$s at %4$s%5$s <span class="says">said:</span>', 'twentyeleven' ), 418 418 sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ), 419 419 '<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '"><time pubdate datetime="' . get_comment_time( 'c' ) . '">', 420 420 get_comment_date(), 421 421 get_comment_time(), 422 '</time></a>' 422 '</time></a>' 423 423 ); 424 424 ?> 425 426 <?php edit_comment_link( __( '[Edit]', 'twentyeleven' ), ' ' ); ?> 425 426 <?php edit_comment_link( __( '[Edit]', 'twentyeleven' ), ' ' ); ?> 427 427 </div><!-- .comment-author .vcard --> 428 428 429 429 <?php if ( $comment->comment_approved == '0' ) : ?> -
wp-content/themes/twentyeleven/header.php
52 52 <h1 id="site-title"><span><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1> 53 53 <h2 id="site-description"><?php bloginfo( 'description' ); ?></h2> 54 54 </hgroup> 55 55 56 56 <?php 57 57 // Check to see if the header image has been removed 58 58 if ( get_header_image() != '' ) : -
wp-content/themes/twentyeleven/image.php
10 10 <div id="content" role="main"> 11 11 12 12 <?php the_post(); ?> 13 13 14 14 <nav id="nav-single"> 15 15 <span class="nav-previous"><?php previous_image_link( false, __( '← Previous' , 'twentyeleven' ) ); ?></span> 16 16 <span class="nav-next"><?php next_image_link( false, __( 'Next →' , 'twentyeleven' ) ); ?></span> 17 </nav><!-- #nav-single --> 17 </nav><!-- #nav-single --> 18 18 19 19 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 20 20 <header class="entry-header"> … … 70 70 $attachment_size = apply_filters( 'theme_attachment_size', 848 ); 71 71 echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height. 72 72 ?></a> 73 73 74 74 <?php if ( ! empty( $post->post_excerpt ) ) : ?> 75 75 <div class="entry-caption"> 76 76 <?php the_excerpt(); ?> 77 77 </div> 78 <?php endif; ?> 78 <?php endif; ?> 79 79 </div><!-- .attachment --> 80 80 81 81 </div><!-- .entry-attachment --> -
wp-content/themes/twentyeleven/index.php
1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <div id="primary"> 10 <div id="content" role="main"> 11 12 <?php twentyeleven_content_nav( 'nav-above' ); ?> 13 14 <?php /* Start the Loop */ ?> 15 <?php while ( have_posts() ) : the_post(); ?> 16 17 <?php get_template_part( 'content', get_post_format() ); ?> 18 19 <?php endwhile; ?> 20 21 <?php twentyeleven_content_nav( 'nav-below' ); ?> 22 23 </div><!-- #content --> 24 </div><!-- #primary --> 25 26 <?php get_sidebar(); ?> 1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <div id="primary"> 10 <div id="content" role="main"> 11 12 <?php twentyeleven_content_nav( 'nav-above' ); ?> 13 14 <?php /* Start the Loop */ ?> 15 <?php while ( have_posts() ) : the_post(); ?> 16 17 <?php get_template_part( 'content', get_post_format() ); ?> 18 19 <?php endwhile; ?> 20 21 <?php twentyeleven_content_nav( 'nav-below' ); ?> 22 23 </div><!-- #content --> 24 </div><!-- #primary --> 25 26 <?php get_sidebar(); ?> 27 27 <?php get_footer(); ?> 28 No newline at end of file -
wp-content/themes/twentyeleven/page.php
1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <div id="primary"> 10 <div id="content" role="main"> 11 12 <?php the_post(); ?> 13 14 <?php get_template_part( 'content', 'page' ); ?> 15 16 <?php comments_template( '', true ); ?> 17 18 </div><!-- #content --> 19 </div><!-- #primary --> 20 1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <div id="primary"> 10 <div id="content" role="main"> 11 12 <?php the_post(); ?> 13 14 <?php get_template_part( 'content', 'page' ); ?> 15 16 <?php comments_template( '', true ); ?> 17 18 </div><!-- #content --> 19 </div><!-- #primary --> 20 21 21 <?php get_footer(); ?> 22 No newline at end of file -
wp-content/themes/twentyeleven/search.php
1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <section id="primary"> 10 <div id="content" role="main"> 11 12 <?php if ( have_posts() ) : ?> 13 14 <header class="page-header"> 15 <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyeleven' ), '<span>' . get_search_query() . '</span>' ); ?></h1> 16 </header> 17 18 <?php twentyeleven_content_nav( 'nav-above' ); ?> 19 20 <?php /* Start the Loop */ ?> 21 <?php while ( have_posts() ) : the_post(); ?> 22 23 <?php get_template_part( 'content', 'search' ); ?> 24 25 <?php endwhile; ?> 26 27 <?php twentyeleven_content_nav( 'nav-below' ); ?> 28 29 <?php else : ?> 30 31 <article id="post-0" class="post no-results not-found"> 32 <header class="entry-header"> 33 <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1> 34 </header><!-- .entry-header --> 35 36 <div class="entry-content"> 37 <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyeleven' ); ?></p> 38 <?php get_search_form(); ?> 39 </div><!-- .entry-content --> 40 </article><!-- #post-0 --> 41 42 <?php endif; ?> 43 44 </div><!-- #content --> 45 </section><!-- #primary --> 46 47 <?php get_sidebar(); ?> 1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <section id="primary"> 10 <div id="content" role="main"> 11 12 <?php if ( have_posts() ) : ?> 13 14 <header class="page-header"> 15 <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyeleven' ), '<span>' . get_search_query() . '</span>' ); ?></h1> 16 </header> 17 18 <?php twentyeleven_content_nav( 'nav-above' ); ?> 19 20 <?php /* Start the Loop */ ?> 21 <?php while ( have_posts() ) : the_post(); ?> 22 23 <?php get_template_part( 'content', 'search' ); ?> 24 25 <?php endwhile; ?> 26 27 <?php twentyeleven_content_nav( 'nav-below' ); ?> 28 29 <?php else : ?> 30 31 <article id="post-0" class="post no-results not-found"> 32 <header class="entry-header"> 33 <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1> 34 </header><!-- .entry-header --> 35 36 <div class="entry-content"> 37 <p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'twentyeleven' ); ?></p> 38 <?php get_search_form(); ?> 39 </div><!-- .entry-content --> 40 </article><!-- #post-0 --> 41 42 <?php endif; ?> 43 44 </div><!-- #content --> 45 </section><!-- #primary --> 46 47 <?php get_sidebar(); ?> 48 48 <?php get_footer(); ?> 49 No newline at end of file -
wp-content/themes/twentyeleven/searchform.php
1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 ?> 7 <form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> 8 <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> 9 <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> 10 </form> 1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 ?> 7 <form method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> 8 <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> 9 <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> 10 </form> 11 No newline at end of file -
wp-content/themes/twentyeleven/showcase.php
1 <?php 2 /** 3 * Template Name: Showcase Template 4 * Description: A Page Template that showcases Sticky Posts, Asides, and Blog Posts 5 * 6 * @package WordPress 7 * @subpackage Twenty Eleven 8 */ 9 10 get_header(); ?> 11 12 <div id="primary" class="showcase"> 13 <div id="content" role="main"> 14 15 <?php the_post(); ?> 16 17 <?php 18 // If we have content for this page, let's display it. 19 if ( '' != get_the_content() ) 20 get_template_part( 'content', 'intro' ); 21 ?> 22 23 <?php 24 // See if we have any sticky posts and use the latest to create a featured post 25 $sticky = get_option( 'sticky_posts' ); 26 $featured_args = array( 27 'posts_per_page' => 1, 28 'post__in' => $sticky, 29 ); 30 31 $featured = new WP_Query(); 32 $featured->query( $featured_args ); 33 34 // Let's roll. 35 if ( $sticky ) : 36 37 $featured->the_post(); 38 39 // We're going to add a class to our featured post for featured images 40 // by default it'll have no class though 41 $feature_class = ''; 42 43 if ( has_post_thumbnail() ) { 44 // … but if it has a featured image let's add some class 45 $feature_class = 'feature-image small'; 46 47 // Hang on. Let's check this here image out. 48 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ); 49 50 // Is it bigger than or equal to our header? 51 if ( $image[1] >= HEADER_IMAGE_WIDTH ) { 52 // Let's add a BIGGER class. It's EXTRA classy now. 53 $feature_class = 'feature-image large'; 54 } 55 } 56 ?> 57 58 <?php if ( has_post_thumbnail() ) : ?> 59 <section class="featured-post <?php echo $feature_class; ?>"> 60 <?php else : ?> 61 <section class="featured-post"> 62 <?php endif; ?> 63 <h1 class="showcase-heading"><?php _e( 'Featured Post', 'twentyeleven' ); ?></h1> 64 <?php 65 // Dynamic thumbnails! 66 if ( has_post_thumbnail() ) { 67 if ( $image[1] >= HEADER_IMAGE_WIDTH ) { ?> 68 <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> 69 <?php } else { ?> 70 <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> 71 <?php } 72 } 73 ?> 74 <?php get_template_part( 'content', 'featured' ); ?> 75 </section> 76 <?php endif; ?> 77 78 <section class="recent-posts"> 79 <h1 class="showcase-heading"><?php _e( 'Recent Posts', 'twentyeleven' ); ?></h1> 80 81 <?php 82 83 // Display our recent posts, showing full content for the very latest, ignoring Aside posts 84 $recent_args = array( 85 'order' => 'DESC', 86 'post__not_in' => get_option( 'sticky_posts' ), 87 'tax_query' => array( 88 array( 89 'taxonomy' => 'post_format', 90 'terms' => array( 'post-format-aside', 'post-format-link' ), 91 'field' => 'slug', 92 'operator' => 'NOT IN', 93 ), 94 ), 95 ); 96 $recent = new WP_Query(); 97 $recent->query( $recent_args ); 98 $counter = 0; 99 100 while ( $recent->have_posts() ) : $recent->the_post(); 101 // set $more to 0 in order to only get the first part of the post 102 global $more; 103 $more = 0; 104 $counter++; 105 106 if ( 1 == $counter ) : 107 get_template_part( 'content', get_post_format() ); 108 echo '<ol class="other-recent-posts">'; 109 110 else : ?> 111 <li class="entry-title"> 112 <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> 113 <span class="comments-link"> 114 <?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?> 115 </span> 116 </li> 117 118 <?php endif; 119 endwhile; 120 ?> 121 122 </ol> 123 </section> 124 125 <div class="widget-area" role="complementary"> 126 <?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?> 127 128 <?php 129 the_widget( 'Twenty_Eleven_Ephemera_Widget', '', 'before_title=<h1 class="widget-title">&after_title=</h1>' ); 130 ?> 131 132 <?php endif; // end sidebar widget area ?> 133 </div><!-- .widget-area --> 134 135 </div><!-- #content --> 136 </div><!-- #primary --> 137 1 <?php 2 /** 3 * Template Name: Showcase Template 4 * Description: A Page Template that showcases Sticky Posts, Asides, and Blog Posts 5 * 6 * @package WordPress 7 * @subpackage Twenty Eleven 8 */ 9 10 get_header(); ?> 11 12 <div id="primary" class="showcase"> 13 <div id="content" role="main"> 14 15 <?php the_post(); ?> 16 17 <?php 18 // If we have content for this page, let's display it. 19 if ( '' != get_the_content() ) 20 get_template_part( 'content', 'intro' ); 21 ?> 22 23 <?php 24 // See if we have any sticky posts and use the latest to create a featured post 25 $sticky = get_option( 'sticky_posts' ); 26 $featured_args = array( 27 'posts_per_page' => 1, 28 'post__in' => $sticky, 29 ); 30 31 $featured = new WP_Query(); 32 $featured->query( $featured_args ); 33 34 // Let's roll. 35 if ( $sticky ) : 36 37 $featured->the_post(); 38 39 // We're going to add a class to our featured post for featured images 40 // by default it'll have no class though 41 $feature_class = ''; 42 43 if ( has_post_thumbnail() ) { 44 // … but if it has a featured image let's add some class 45 $feature_class = 'feature-image small'; 46 47 // Hang on. Let's check this here image out. 48 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ); 49 50 // Is it bigger than or equal to our header? 51 if ( $image[1] >= HEADER_IMAGE_WIDTH ) { 52 // Let's add a BIGGER class. It's EXTRA classy now. 53 $feature_class = 'feature-image large'; 54 } 55 } 56 ?> 57 58 <?php if ( has_post_thumbnail() ) : ?> 59 <section class="featured-post <?php echo $feature_class; ?>"> 60 <?php else : ?> 61 <section class="featured-post"> 62 <?php endif; ?> 63 <h1 class="showcase-heading"><?php _e( 'Featured Post', 'twentyeleven' ); ?></h1> 64 <?php 65 // Dynamic thumbnails! 66 if ( has_post_thumbnail() ) { 67 if ( $image[1] >= HEADER_IMAGE_WIDTH ) { ?> 68 <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> 69 <?php } else { ?> 70 <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> 71 <?php } 72 } 73 ?> 74 <?php get_template_part( 'content', 'featured' ); ?> 75 </section> 76 <?php endif; ?> 77 78 <section class="recent-posts"> 79 <h1 class="showcase-heading"><?php _e( 'Recent Posts', 'twentyeleven' ); ?></h1> 80 81 <?php 82 83 // Display our recent posts, showing full content for the very latest, ignoring Aside posts 84 $recent_args = array( 85 'order' => 'DESC', 86 'post__not_in' => get_option( 'sticky_posts' ), 87 'tax_query' => array( 88 array( 89 'taxonomy' => 'post_format', 90 'terms' => array( 'post-format-aside', 'post-format-link' ), 91 'field' => 'slug', 92 'operator' => 'NOT IN', 93 ), 94 ), 95 ); 96 $recent = new WP_Query(); 97 $recent->query( $recent_args ); 98 $counter = 0; 99 100 while ( $recent->have_posts() ) : $recent->the_post(); 101 // set $more to 0 in order to only get the first part of the post 102 global $more; 103 $more = 0; 104 $counter++; 105 106 if ( 1 == $counter ) : 107 get_template_part( 'content', get_post_format() ); 108 echo '<ol class="other-recent-posts">'; 109 110 else : ?> 111 <li class="entry-title"> 112 <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> 113 <span class="comments-link"> 114 <?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?> 115 </span> 116 </li> 117 118 <?php endif; 119 endwhile; 120 ?> 121 122 </ol> 123 </section> 124 125 <div class="widget-area" role="complementary"> 126 <?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?> 127 128 <?php 129 the_widget( 'Twenty_Eleven_Ephemera_Widget', '', 'before_title=<h1 class="widget-title">&after_title=</h1>' ); 130 ?> 131 132 <?php endif; // end sidebar widget area ?> 133 </div><!-- .widget-area --> 134 135 </div><!-- #content --> 136 </div><!-- #primary --> 137 138 138 <?php get_footer(); ?> 139 No newline at end of file -
wp-content/themes/twentyeleven/sidebar.php
1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 ?> 7 <div id="secondary" class="widget-area" role="complementary"> 8 <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?> 9 10 <aside id="archives" class="widget"> 11 <h1 class="widget-title"><?php _e( 'Archives', 'twentyeleven' ); ?></h1> 12 <ul> 13 <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?> 14 </ul> 15 </aside> 16 17 <aside id="meta" class="widget"> 18 <h1 class="widget-title"><?php _e( 'Meta', 'twentyeleven' ); ?></h1> 19 <ul> 20 <?php wp_register(); ?> 21 <li><?php wp_loginout(); ?></li> 22 <?php wp_meta(); ?> 23 </ul> 24 </aside> 25 26 <?php endif; // end sidebar widget area ?> 27 </div><!-- #secondary .widget-area --> 28 29 No newline at end of file 1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 ?> 7 <div id="secondary" class="widget-area" role="complementary"> 8 <?php if ( ! dynamic_sidebar( 'sidebar-1' ) ) : ?> 9 10 <aside id="archives" class="widget"> 11 <h1 class="widget-title"><?php _e( 'Archives', 'twentyeleven' ); ?></h1> 12 <ul> 13 <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?> 14 </ul> 15 </aside> 16 17 <aside id="meta" class="widget"> 18 <h1 class="widget-title"><?php _e( 'Meta', 'twentyeleven' ); ?></h1> 19 <ul> 20 <?php wp_register(); ?> 21 <li><?php wp_loginout(); ?></li> 22 <?php wp_meta(); ?> 23 </ul> 24 </aside> 25 26 <?php endif; // end sidebar widget area ?> 27 </div><!-- #secondary .widget-area --> -
wp-content/themes/twentyeleven/single.php
1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <div id="primary"> 10 <div id="content" role="main"> 11 12 <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> 13 14 <nav id="nav-single"> 15 <h1 class="section-heading"><?php _e( 'Post navigation', 'toolbox' ); ?></h1> 16 <span class="nav-previous"><?php previous_post_link( '%link', __( '← Previous', 'twentyeleven' ) ); ?></span> 17 <span class="nav-next"><?php next_post_link( '%link', __( 'Next →', 'twentyeleven' ) ); ?></span> 18 </nav><!-- #nav-single --> 19 20 <?php get_template_part( 'content', 'single' ); ?> 21 22 <?php twentyeleven_content_nav( 'nav-below' ); ?> 23 24 <?php comments_template( '', true ); ?> 25 26 <?php endwhile; // end of the loop. ?> 27 28 </div><!-- #content --> 29 </div><!-- #primary --> 30 1 <?php 2 /** 3 * @package WordPress 4 * @subpackage Twenty Eleven 5 */ 6 7 get_header(); ?> 8 9 <div id="primary"> 10 <div id="content" role="main"> 11 12 <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> 13 14 <nav id="nav-single"> 15 <h1 class="section-heading"><?php _e( 'Post navigation', 'toolbox' ); ?></h1> 16 <span class="nav-previous"><?php previous_post_link( '%link', __( '← Previous', 'twentyeleven' ) ); ?></span> 17 <span class="nav-next"><?php next_post_link( '%link', __( 'Next →', 'twentyeleven' ) ); ?></span> 18 </nav><!-- #nav-single --> 19 20 <?php get_template_part( 'content', 'single' ); ?> 21 22 <?php twentyeleven_content_nav( 'nav-below' ); ?> 23 24 <?php comments_template( '', true ); ?> 25 26 <?php endwhile; // end of the loop. ?> 27 28 </div><!-- #content --> 29 </div><!-- #primary --> 30 31 31 <?php get_footer(); ?> 32 No newline at end of file -
wp-content/themes/twentyeleven/tag.php
1 <?php 2 /** 3 * The template used to display Tag Archive pages 4 * 5 * @package WordPress 6 * @subpackage Twenty Eleven 7 */ 8 9 get_header(); ?> 10 11 <section id="primary"> 12 <div id="content" role="main"> 13 14 <?php the_post(); ?> 15 16 <header class="page-header"> 17 <h1 class="page-title"><?php 18 printf( __( 'Tag Archives: %s', 'twentyeleven' ), '<span>' . single_tag_title( '', false ) . '</span>' ); 19 ?></h1> 20 </header> 21 22 <?php rewind_posts(); ?> 23 24 <?php twentyeleven_content_nav( 'nav-above' ); ?> 25 26 <?php /* Start the Loop */ ?> 27 <?php while ( have_posts() ) : the_post(); ?> 28 29 <?php get_template_part( 'content', get_post_format() ); ?> 30 31 <?php endwhile; ?> 32 33 <?php twentyeleven_content_nav( 'nav-below' ); ?> 34 35 </div><!-- #content --> 36 </section><!-- #primary --> 37 38 <?php get_sidebar(); ?> 1 <?php 2 /** 3 * The template used to display Tag Archive pages 4 * 5 * @package WordPress 6 * @subpackage Twenty Eleven 7 */ 8 9 get_header(); ?> 10 11 <section id="primary"> 12 <div id="content" role="main"> 13 14 <?php the_post(); ?> 15 16 <header class="page-header"> 17 <h1 class="page-title"><?php 18 printf( __( 'Tag Archives: %s', 'twentyeleven' ), '<span>' . single_tag_title( '', false ) . '</span>' ); 19 ?></h1> 20 </header> 21 22 <?php rewind_posts(); ?> 23 24 <?php twentyeleven_content_nav( 'nav-above' ); ?> 25 26 <?php /* Start the Loop */ ?> 27 <?php while ( have_posts() ) : the_post(); ?> 28 29 <?php get_template_part( 'content', get_post_format() ); ?> 30 31 <?php endwhile; ?> 32 33 <?php twentyeleven_content_nav( 'nav-below' ); ?> 34 35 </div><!-- #content --> 36 </section><!-- #primary --> 37 38 <?php get_sidebar(); ?> 39 39 <?php get_footer(); ?> 40 No newline at end of file -
wp-content/themes/twentyeleven/widgets.php
1 <?php 2 /** 3 * new WordPress Widget format 4 * Wordpress 2.8 and above 5 * @see http://codex.wordpress.org/Widgets_API#Developing_Widgets 6 */ 7 class Twenty_Eleven_Ephemera_Widget extends WP_Widget { 8 9 /** 10 * Constructor 11 * 12 * @return void 13 **/ 14 function Twenty_Eleven_Ephemera_Widget() { 15 $widget_ops = array( 'classname' => 'widget_twentyeleven_ephemera', 'description' => __( 'Use this widget to list your recent Aside and Link posts', 'twentyeleven' ) ); 16 $this->WP_Widget( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), $widget_ops ); 17 $this->alt_option_name = 'widget_twentyeleven_ephemera'; 18 19 add_action( 'save_post', array(&$this, 'flush_widget_cache' ) ); 20 add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) ); 21 add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) ); 22 23 } 24 25 /** 26 * Outputs the HTML for this widget. 27 * 28 * @param array An array of standard parameters for widgets in this theme 29 * @param array An array of settings for this widget instance 30 * @return void Echoes it's output 31 **/ 32 function widget( $args, $instance ) { 33 $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' ); 34 35 if ( !is_array($cache) ) 36 $cache = array(); 37 38 if ( ! isset( $args['widget_id'] ) ) 39 $args['widget_id'] = null; 40 41 if ( isset($cache[$args['widget_id']]) ) { 42 echo $cache[$args['widget_id']]; 43 return; 44 } 45 46 ob_start(); 47 extract( $args, EXTR_SKIP ); 48 49 $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Ephemera' ) : $instance['title'], $instance, $this->id_base); 50 51 if ( ! isset( $instance['number'] ) ) 52 $instance['number'] = '10'; 53 54 if ( ! $number = absint( $instance['number'] ) ) 55 $number = 10; 56 57 $ephemera_args = array( 58 'order' => 'DESC', 59 'posts_per_page' => $number, 60 'nopaging' => 0, 61 'post_status' => 'publish', 62 'post__not_in' => get_option( 'sticky_posts' ), 63 'tax_query' => array( 64 array( 65 'taxonomy' => 'post_format', 66 'terms' => array( 'post-format-aside', 'post-format-link' ), 67 'field' => 'slug', 68 'operator' => 'IN', 69 ), 70 ), 71 ); 72 $ephemera = new WP_Query(); 73 $ephemera->query( $ephemera_args ); 74 75 if ( $ephemera->have_posts() ) : 76 77 echo $before_widget; 78 echo $before_title; 79 echo $title; // Can set this with a widget option, or omit altogether 80 echo $after_title; 81 82 global $post; 83 84 ?> 85 <ol> 86 <?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); ?> 87 88 <?php if ( 'aside' == get_post_format( $post->ID ) ) : ?> 89 90 <li class="entry-title"> 91 <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> 92 <span class="comments-link"> 93 <?php comments_popup_link( __( '0 <span class="reply">comments →</span>', 'twentyeleven' ), __( '1 <span class="reply">comment →</span>', 'twentyeleven' ), __( '% <span class="reply">comments →</span>', 'twentyeleven' ) ); ?> 94 </span> 95 </li> 96 97 <?php elseif ( 'link' == get_post_format( $post->ID ) ) : ?> 98 99 <li class="entry-title"> 100 <?php 101 $link_url = get_permalink(); 102 103 if ( false != twentyeleven_url_grabber() ) 104 $link_url = twentyeleven_url_grabber(); 105 ?> 106 <a href="<?php echo $link_url; ?>" title="<?php printf( esc_attr__( 'Link to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?> <span>→</span></a> 107 <span class="comments-link"> 108 <?php comments_popup_link( __( '0 <span class="reply">comments →</span>', 'twentyeleven' ), __( '1 <span class="reply">comment →</span>', 'twentyeleven' ), __( '% <span class="reply">comments →</span>', 'twentyeleven' ) ); ?> 109 </span> 110 </li> 111 112 <?php endif; ?> 113 114 <?php endwhile; ?> 115 </ol> 116 <?php 117 118 echo $after_widget; 119 120 // Reset the global $the_post as this query will have stomped on it 121 wp_reset_postdata(); 122 123 // end check for ephemeral posts 124 endif; 125 126 $cache[$args['widget_id']] = ob_get_flush(); 127 wp_cache_set( 'widget_twentyeleven_ephemera', $cache, 'widget' ); 128 } 129 130 /** 131 * Deals with the settings when they are saved by the admin. Here is 132 * where any validation should be dealt with. 133 **/ 134 function update( $new_instance, $old_instance ) { 135 $instance = $old_instance; 136 $instance['title'] = strip_tags($new_instance['title']); 137 $instance['number'] = (int) $new_instance['number']; 138 $this->flush_widget_cache(); 139 140 $alloptions = wp_cache_get( 'alloptions', 'options' ); 141 if ( isset($alloptions['widget_twentyeleven_ephemera']) ) 142 delete_option( 'widget_twentyeleven_ephemera' ); 143 144 return $instance; 145 } 146 147 function flush_widget_cache() { 148 wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' ); 149 } 150 151 /** 152 * Displays the form for this widget on the Widgets page of the WP Admin area. 153 **/ 154 function form( $instance ) { 155 $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; 156 $number = isset($instance['number']) ? absint($instance['number']) : 10; 157 ?> 158 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'twentyeleven' ); ?></label> 159 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p> 160 161 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'twentyeleven' ); ?></label> 162 <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p> 163 <?php 164 } 165 } 166 1 <?php 2 /** 3 * new WordPress Widget format 4 * Wordpress 2.8 and above 5 * @see http://codex.wordpress.org/Widgets_API#Developing_Widgets 6 */ 7 class Twenty_Eleven_Ephemera_Widget extends WP_Widget { 8 9 /** 10 * Constructor 11 * 12 * @return void 13 **/ 14 function Twenty_Eleven_Ephemera_Widget() { 15 $widget_ops = array( 'classname' => 'widget_twentyeleven_ephemera', 'description' => __( 'Use this widget to list your recent Aside and Link posts', 'twentyeleven' ) ); 16 $this->WP_Widget( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), $widget_ops ); 17 $this->alt_option_name = 'widget_twentyeleven_ephemera'; 18 19 add_action( 'save_post', array(&$this, 'flush_widget_cache' ) ); 20 add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) ); 21 add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) ); 22 23 } 24 25 /** 26 * Outputs the HTML for this widget. 27 * 28 * @param array An array of standard parameters for widgets in this theme 29 * @param array An array of settings for this widget instance 30 * @return void Echoes it's output 31 **/ 32 function widget( $args, $instance ) { 33 $cache = wp_cache_get( 'widget_twentyeleven_ephemera', 'widget' ); 34 35 if ( !is_array($cache) ) 36 $cache = array(); 37 38 if ( ! isset( $args['widget_id'] ) ) 39 $args['widget_id'] = null; 40 41 if ( isset($cache[$args['widget_id']]) ) { 42 echo $cache[$args['widget_id']]; 43 return; 44 } 45 46 ob_start(); 47 extract( $args, EXTR_SKIP ); 48 49 $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Ephemera' ) : $instance['title'], $instance, $this->id_base); 50 51 if ( ! isset( $instance['number'] ) ) 52 $instance['number'] = '10'; 53 54 if ( ! $number = absint( $instance['number'] ) ) 55 $number = 10; 56 57 $ephemera_args = array( 58 'order' => 'DESC', 59 'posts_per_page' => $number, 60 'nopaging' => 0, 61 'post_status' => 'publish', 62 'post__not_in' => get_option( 'sticky_posts' ), 63 'tax_query' => array( 64 array( 65 'taxonomy' => 'post_format', 66 'terms' => array( 'post-format-aside', 'post-format-link' ), 67 'field' => 'slug', 68 'operator' => 'IN', 69 ), 70 ), 71 ); 72 $ephemera = new WP_Query(); 73 $ephemera->query( $ephemera_args ); 74 75 if ( $ephemera->have_posts() ) : 76 77 echo $before_widget; 78 echo $before_title; 79 echo $title; // Can set this with a widget option, or omit altogether 80 echo $after_title; 81 82 global $post; 83 84 ?> 85 <ol> 86 <?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); ?> 87 88 <?php if ( 'aside' == get_post_format( $post->ID ) ) : ?> 89 90 <li class="entry-title"> 91 <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> 92 <span class="comments-link"> 93 <?php comments_popup_link( __( '0 <span class="reply">comments →</span>', 'twentyeleven' ), __( '1 <span class="reply">comment →</span>', 'twentyeleven' ), __( '% <span class="reply">comments →</span>', 'twentyeleven' ) ); ?> 94 </span> 95 </li> 96 97 <?php elseif ( 'link' == get_post_format( $post->ID ) ) : ?> 98 99 <li class="entry-title"> 100 <?php 101 $link_url = get_permalink(); 102 103 if ( false != twentyeleven_url_grabber() ) 104 $link_url = twentyeleven_url_grabber(); 105 ?> 106 <a href="<?php echo $link_url; ?>" title="<?php printf( esc_attr__( 'Link to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?> <span>→</span></a> 107 <span class="comments-link"> 108 <?php comments_popup_link( __( '0 <span class="reply">comments →</span>', 'twentyeleven' ), __( '1 <span class="reply">comment →</span>', 'twentyeleven' ), __( '% <span class="reply">comments →</span>', 'twentyeleven' ) ); ?> 109 </span> 110 </li> 111 112 <?php endif; ?> 113 114 <?php endwhile; ?> 115 </ol> 116 <?php 117 118 echo $after_widget; 119 120 // Reset the global $the_post as this query will have stomped on it 121 wp_reset_postdata(); 122 123 // end check for ephemeral posts 124 endif; 125 126 $cache[$args['widget_id']] = ob_get_flush(); 127 wp_cache_set( 'widget_twentyeleven_ephemera', $cache, 'widget' ); 128 } 129 130 /** 131 * Deals with the settings when they are saved by the admin. Here is 132 * where any validation should be dealt with. 133 **/ 134 function update( $new_instance, $old_instance ) { 135 $instance = $old_instance; 136 $instance['title'] = strip_tags($new_instance['title']); 137 $instance['number'] = (int) $new_instance['number']; 138 $this->flush_widget_cache(); 139 140 $alloptions = wp_cache_get( 'alloptions', 'options' ); 141 if ( isset($alloptions['widget_twentyeleven_ephemera']) ) 142 delete_option( 'widget_twentyeleven_ephemera' ); 143 144 return $instance; 145 } 146 147 function flush_widget_cache() { 148 wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' ); 149 } 150 151 /** 152 * Displays the form for this widget on the Widgets page of the WP Admin area. 153 **/ 154 function form( $instance ) { 155 $title = isset($instance['title']) ? esc_attr($instance['title']) : ''; 156 $number = isset($instance['number']) ? absint($instance['number']) : 10; 157 ?> 158 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'twentyeleven' ); ?></label> 159 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></p> 160 161 <p><label for="<?php echo $this->get_field_id( 'number' ); ?>"><?php _e( 'Number of posts to show:', 'twentyeleven' ); ?></label> 162 <input id="<?php echo $this->get_field_id( 'number' ); ?>" name="<?php echo $this->get_field_name( 'number' ); ?>" type="text" value="<?php echo $number; ?>" size="3" /></p> 163 <?php 164 } 165 } 166 167 167 add_action( 'widgets_init', create_function( '', "register_widget( 'Twenty_Eleven_Ephemera_Widget' );" ) ); 168 No newline at end of file