Twenty Eleven: strip trailing spaces, props kawauso - see #17198

git-svn-id: http://svn.automattic.com/wordpress/trunk@17714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
lancewillett 2011-04-26 18:34:52 +00:00
parent 78e15233b2
commit 972a41501e
12 changed files with 71 additions and 73 deletions

View File

@ -31,7 +31,7 @@ get_header(); ?>
<?php the_author_meta( 'description' ); ?> <?php the_author_meta( 'description' ); ?>
</div><!-- #author-description --> </div><!-- #author-description -->
</div><!-- #entry-author-info --> </div><!-- #entry-author-info -->
<?php endif; ?> <?php endif; ?>
<?php /* Start the Loop */ ?> <?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?> <?php while ( have_posts() ) : the_post(); ?>

View File

@ -31,7 +31,7 @@
<div class="entry-content"> <div class="entry-content">
<?php if ( post_password_required() ) : ?> <?php if ( post_password_required() ) : ?>
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?> <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
<?php else : ?> <?php else : ?>
<?php <?php
$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
@ -44,7 +44,7 @@
<figure class="gallery-thumb"> <figure class="gallery-thumb">
<a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a> <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
</figure><!-- .gallery-thumb --> </figure><!-- .gallery-thumb -->
<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' ), <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' ),
'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"', 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
number_format_i18n( $total_images ) number_format_i18n( $total_images )

View File

@ -11,7 +11,7 @@
<?php if ( 'post' == $post->post_type ) : ?> <?php if ( 'post' == $post->post_type ) : ?>
<?php endif; ?> <?php endif; ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>
<div class="comments-link"> <div class="comments-link">
<?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?> <?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?>

View File

@ -28,7 +28,7 @@
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( '<span>Pages:</span>', 'twentyeleven' ), 'after' => '</div>' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( '<span>Pages:</span>', 'twentyeleven' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content --> </div><!-- .entry-content -->
<footer class="entry-meta"> <footer class="entry-meta">
<?php <?php
$tag_list = get_the_tag_list( '', ', ' ); $tag_list = get_the_tag_list( '', ', ' );
if ( '' != $tag_list ) { if ( '' != $tag_list ) {
@ -47,7 +47,7 @@
); );
?> ?>
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
<?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries ?> <?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries ?>
<div id="author-info"> <div id="author-info">
<div id="author-avatar"> <div id="author-avatar">

View File

@ -23,7 +23,7 @@
?> ?>
</div><!-- .entry-meta --> </div><!-- .entry-meta -->
<?php endif; ?> <?php endif; ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>
<div class="comments-link"> <div class="comments-link">
<?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?> <?php comments_popup_link( __( '<span class="leave-reply">Reply</span>', 'twentyeleven' ), __( '1', 'twentyeleven' ), __( '%', 'twentyeleven' ) ); ?>
@ -47,12 +47,12 @@
<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyeleven' ); ?></span><?php the_category( ', ' ); ?></span> <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyeleven' ); ?></span><?php the_category( ', ' ); ?></span>
<?php the_tags( '<span class="sep"> | </span><span class="tag-links">' . __( 'Tagged ', 'twentyeleven' ) . '</span>', ', ', '' ); ?> <?php the_tags( '<span class="sep"> | </span><span class="tag-links">' . __( 'Tagged ', 'twentyeleven' ) . '</span>', ', ', '' ); ?>
<?php endif; ?> <?php endif; ?>
<?php if ( comments_open() ) : ?> <?php if ( comments_open() ) : ?>
<span class="sep"> | </span> <span class="sep"> | </span>
<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> <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>
<?php endif; ?> <?php endif; ?>
<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?> <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- #entry-meta --> </footer><!-- #entry-meta -->
</article><!-- #post-<?php the_ID(); ?> --> </article><!-- #post-<?php the_ID(); ?> -->

View File

@ -8,29 +8,29 @@
</div><!-- #main --> </div><!-- #main -->
<footer id="colophon" role="contentinfo"> <footer id="colophon" role="contentinfo">
<?php if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) ) : ?> <?php if ( is_active_sidebar( 'sidebar-3' ) || is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) ) : ?>
<div id="supplementary" <?php twentyeleven_footer_sidebar_class(); ?>> <div id="supplementary" <?php twentyeleven_footer_sidebar_class(); ?>>
<?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?> <?php if ( is_active_sidebar( 'sidebar-3' ) ) : ?>
<div id="first" class="widget-area" role="complementary"> <div id="first" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-3' ); ?> <?php dynamic_sidebar( 'sidebar-3' ); ?>
</div><!-- #first .widget-area --> </div><!-- #first .widget-area -->
<?php endif; ?> <?php endif; ?>
<?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?> <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?>
<div id="second" class="widget-area" role="complementary"> <div id="second" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-4' ); ?> <?php dynamic_sidebar( 'sidebar-4' ); ?>
</div><!-- #second .widget-area --> </div><!-- #second .widget-area -->
<?php endif; ?> <?php endif; ?>
<?php if ( is_active_sidebar( 'sidebar-5' ) ) : ?> <?php if ( is_active_sidebar( 'sidebar-5' ) ) : ?>
<div id="third" class="widget-area" role="complementary"> <div id="third" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-5' ); ?> <?php dynamic_sidebar( 'sidebar-5' ); ?>
</div><!-- #third .widget-area --> </div><!-- #third .widget-area -->
<?php endif; ?> <?php endif; ?>
</div><!-- #supplementary --> </div><!-- #supplementary -->
<?php endif; ?> <?php endif; ?>
<div id="site-generator"> <div id="site-generator">
<a href="http://wordpress.org/" rel="generator">Proudly powered by WordPress</a><span class="sep"> | </span><?php printf( __( 'Theme: %1$s.', 'twentyeleven' ), 'Twenty Eleven' ); ?> <a href="http://wordpress.org/" rel="generator">Proudly powered by WordPress</a><span class="sep"> | </span><?php printf( __( 'Theme: %1$s.', 'twentyeleven' ), 'Twenty Eleven' ); ?>
</div> </div>

View File

@ -285,7 +285,7 @@ function twentyeleven_widgets_init() {
'before_title' => '<h1 class="widget-title">', 'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>', 'after_title' => '</h1>',
) ); ) );
register_sidebar( array( register_sidebar( array(
'name' => __( 'Footer Area Two', 'twentyeleven' ), 'name' => __( 'Footer Area Two', 'twentyeleven' ),
'id' => 'sidebar-4', 'id' => 'sidebar-4',
@ -295,7 +295,7 @@ function twentyeleven_widgets_init() {
'before_title' => '<h1 class="widget-title">', 'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>', 'after_title' => '</h1>',
) ); ) );
register_sidebar( array( register_sidebar( array(
'name' => __( 'Footer Area Three', 'twentyeleven' ), 'name' => __( 'Footer Area Three', 'twentyeleven' ),
'id' => 'sidebar-5', 'id' => 'sidebar-5',
@ -305,7 +305,6 @@ function twentyeleven_widgets_init() {
'before_title' => '<h1 class="widget-title">', 'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>', 'after_title' => '</h1>',
) ); ) );
} }
add_action( 'init', 'twentyeleven_widgets_init' ); add_action( 'init', 'twentyeleven_widgets_init' );
@ -355,7 +354,7 @@ function twentyeleven_url_grabber() {
*/ */
function twentyeleven_footer_sidebar_class() { function twentyeleven_footer_sidebar_class() {
$count = 0; $count = 0;
if ( is_active_sidebar( 'sidebar-3' ) ) if ( is_active_sidebar( 'sidebar-3' ) )
$count++; $count++;
@ -364,7 +363,7 @@ function twentyeleven_footer_sidebar_class() {
if ( is_active_sidebar( 'sidebar-5' ) ) if ( is_active_sidebar( 'sidebar-5' ) )
$count++; $count++;
switch ( $count ) { switch ( $count ) {
case '1': case '1':
$class = 'one'; $class = 'one';
@ -377,12 +376,12 @@ function twentyeleven_footer_sidebar_class() {
case '3': case '3':
$class = 'three'; $class = 'three';
break; break;
default: default:
$class = ''; $class = '';
break; break;
} }
if ( '' != $class ) if ( '' != $class )
echo 'class="' . $class . '"'; echo 'class="' . $class . '"';
} }
@ -411,19 +410,19 @@ function twentyeleven_comment( $comment, $args, $depth ) {
$avatar_size = 68; $avatar_size = 68;
if ( '0' != $comment->comment_parent ) if ( '0' != $comment->comment_parent )
$avatar_size = 39; $avatar_size = 39;
echo get_avatar( $comment, $avatar_size ); echo get_avatar( $comment, $avatar_size );
printf( __( '%1$s on %2$s%3$s at %4$s%5$s <span class="says">said:</span>', 'twentyeleven' ), printf( __( '%1$s on %2$s%3$s at %4$s%5$s <span class="says">said:</span>', 'twentyeleven' ),
sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ),
'<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '"><time pubdate datetime="' . get_comment_time( 'c' ) . '">', '<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '"><time pubdate datetime="' . get_comment_time( 'c' ) . '">',
get_comment_date(), get_comment_date(),
get_comment_time(), get_comment_time(),
'</time></a>' '</time></a>'
); );
?> ?>
<?php edit_comment_link( __( '[Edit]', 'twentyeleven' ), ' ' ); ?> <?php edit_comment_link( __( '[Edit]', 'twentyeleven' ), ' ' ); ?>
</div><!-- .comment-author .vcard --> </div><!-- .comment-author .vcard -->
<?php if ( $comment->comment_approved == '0' ) : ?> <?php if ( $comment->comment_approved == '0' ) : ?>

View File

@ -52,7 +52,7 @@
<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> <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>
<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2> <h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup> </hgroup>
<?php <?php
// Check to see if the header image has been removed // Check to see if the header image has been removed
if ( get_header_image() != '' ) : if ( get_header_image() != '' ) :

View File

@ -10,11 +10,11 @@ get_header(); ?>
<div id="content" role="main"> <div id="content" role="main">
<?php the_post(); ?> <?php the_post(); ?>
<nav id="nav-single"> <nav id="nav-single">
<span class="nav-previous"><?php previous_image_link( false, __( '&larr; Previous' , 'twentyeleven' ) ); ?></span> <span class="nav-previous"><?php previous_image_link( false, __( '&larr; Previous' , 'twentyeleven' ) ); ?></span>
<span class="nav-next"><?php next_image_link( false, __( 'Next &rarr;' , 'twentyeleven' ) ); ?></span> <span class="nav-next"><?php next_image_link( false, __( 'Next &rarr;' , 'twentyeleven' ) ); ?></span>
</nav><!-- #nav-single --> </nav><!-- #nav-single -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header"> <header class="entry-header">
@ -70,12 +70,12 @@ get_header(); ?>
$attachment_size = apply_filters( 'theme_attachment_size', 848 ); $attachment_size = apply_filters( 'theme_attachment_size', 848 );
echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height. echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height.
?></a> ?></a>
<?php if ( ! empty( $post->post_excerpt ) ) : ?> <?php if ( ! empty( $post->post_excerpt ) ) : ?>
<div class="entry-caption"> <div class="entry-caption">
<?php the_excerpt(); ?> <?php the_excerpt(); ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div><!-- .attachment --> </div><!-- .attachment -->
</div><!-- .entry-attachment --> </div><!-- .entry-attachment -->

View File

@ -11,15 +11,15 @@ get_header(); ?>
<div id="primary" class="showcase"> <div id="primary" class="showcase">
<div id="content" role="main"> <div id="content" role="main">
<?php the_post(); ?> <?php the_post(); ?>
<?php <?php
// If we have content for this page, let's display it. // If we have content for this page, let's display it.
if ( '' != get_the_content() ) if ( '' != get_the_content() )
get_template_part( 'content', 'intro' ); get_template_part( 'content', 'intro' );
?> ?>
<?php <?php
// See if we have any sticky posts and use the latest to create a featured post // See if we have any sticky posts and use the latest to create a featured post
$sticky = get_option( 'sticky_posts' ); $sticky = get_option( 'sticky_posts' );
@ -27,15 +27,15 @@ get_header(); ?>
'posts_per_page' => 1, 'posts_per_page' => 1,
'post__in' => $sticky, 'post__in' => $sticky,
); );
$featured = new WP_Query(); $featured = new WP_Query();
$featured->query( $featured_args ); $featured->query( $featured_args );
// Let's roll. // Let's roll.
if ( $sticky ) : if ( $sticky ) :
$featured->the_post(); $featured->the_post();
// We're going to add a class to our featured post for featured images // We're going to add a class to our featured post for featured images
// by default it'll have no class though // by default it'll have no class though
$feature_class = ''; $feature_class = '';
@ -54,7 +54,7 @@ get_header(); ?>
} }
} }
?> ?>
<?php if ( has_post_thumbnail() ) : ?> <?php if ( has_post_thumbnail() ) : ?>
<section class="featured-post <?php echo $feature_class; ?>"> <section class="featured-post <?php echo $feature_class; ?>">
<?php else : ?> <?php else : ?>
@ -69,15 +69,15 @@ get_header(); ?>
<?php } else { ?> <?php } else { ?>
<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> <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>
<?php } <?php }
} }
?> ?>
<?php get_template_part( 'content', 'featured' ); ?> <?php get_template_part( 'content', 'featured' ); ?>
</section> </section>
<?php endif; ?> <?php endif; ?>
<section class="recent-posts"> <section class="recent-posts">
<h1 class="showcase-heading"><?php _e( 'Recent Posts', 'twentyeleven' ); ?></h1> <h1 class="showcase-heading"><?php _e( 'Recent Posts', 'twentyeleven' ); ?></h1>
<?php <?php
// Display our recent posts, showing full content for the very latest, ignoring Aside posts // Display our recent posts, showing full content for the very latest, ignoring Aside posts
@ -96,17 +96,17 @@ get_header(); ?>
$recent = new WP_Query(); $recent = new WP_Query();
$recent->query( $recent_args ); $recent->query( $recent_args );
$counter = 0; $counter = 0;
while ( $recent->have_posts() ) : $recent->the_post(); while ( $recent->have_posts() ) : $recent->the_post();
// set $more to 0 in order to only get the first part of the post // set $more to 0 in order to only get the first part of the post
global $more; global $more;
$more = 0; $more = 0;
$counter++; $counter++;
if ( 1 == $counter ) : if ( 1 == $counter ) :
get_template_part( 'content', get_post_format() ); get_template_part( 'content', get_post_format() );
echo '<ol class="other-recent-posts">'; echo '<ol class="other-recent-posts">';
else : ?> else : ?>
<li class="entry-title"> <li 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> <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>
@ -114,20 +114,20 @@ get_header(); ?>
<?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?> <?php comments_popup_link( __( '<span class="leave-reply">Leave a reply</span>', 'twentyeleven' ), __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?>
</span> </span>
</li> </li>
<?php endif; <?php endif;
endwhile; endwhile;
?> ?>
</ol> </ol>
</section> </section>
<div class="widget-area" role="complementary"> <div class="widget-area" role="complementary">
<?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?> <?php if ( ! dynamic_sidebar( 'sidebar-2' ) ) : ?>
<?php <?php
the_widget( 'Twenty_Eleven_Ephemera_Widget', '', 'before_title=<h1 class="widget-title">&after_title=</h1>' ); the_widget( 'Twenty_Eleven_Ephemera_Widget', '', 'before_title=<h1 class="widget-title">&after_title=</h1>' );
?> ?>
<?php endif; // end sidebar widget area ?> <?php endif; // end sidebar widget area ?>
</div><!-- .widget-area --> </div><!-- .widget-area -->

View File

@ -25,4 +25,3 @@
<?php endif; // end sidebar widget area ?> <?php endif; // end sidebar widget area ?>
</div><!-- #secondary .widget-area --> </div><!-- #secondary .widget-area -->

View File

@ -5,7 +5,7 @@
* @see http://codex.wordpress.org/Widgets_API#Developing_Widgets * @see http://codex.wordpress.org/Widgets_API#Developing_Widgets
*/ */
class Twenty_Eleven_Ephemera_Widget extends WP_Widget { class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
/** /**
* Constructor * Constructor
* *
@ -15,18 +15,18 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
$widget_ops = array( 'classname' => 'widget_twentyeleven_ephemera', 'description' => __( 'Use this widget to list your recent Aside and Link posts', 'twentyeleven' ) ); $widget_ops = array( 'classname' => 'widget_twentyeleven_ephemera', 'description' => __( 'Use this widget to list your recent Aside and Link posts', 'twentyeleven' ) );
$this->WP_Widget( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), $widget_ops ); $this->WP_Widget( 'widget_twentyeleven_ephemera', __( 'Twenty Eleven Ephemera', 'twentyeleven' ), $widget_ops );
$this->alt_option_name = 'widget_twentyeleven_ephemera'; $this->alt_option_name = 'widget_twentyeleven_ephemera';
add_action( 'save_post', array(&$this, 'flush_widget_cache' ) ); add_action( 'save_post', array(&$this, 'flush_widget_cache' ) );
add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) ); add_action( 'deleted_post', array(&$this, 'flush_widget_cache' ) );
add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) ); add_action( 'switch_theme', array(&$this, 'flush_widget_cache' ) );
} }
/** /**
* Outputs the HTML for this widget. * Outputs the HTML for this widget.
* *
* @param array An array of standard parameters for widgets in this theme * @param array An array of standard parameters for widgets in this theme
* @param array An array of settings for this widget instance * @param array An array of settings for this widget instance
* @return void Echoes it's output * @return void Echoes it's output
**/ **/
function widget( $args, $instance ) { function widget( $args, $instance ) {
@ -43,14 +43,14 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
return; return;
} }
ob_start(); ob_start();
extract( $args, EXTR_SKIP ); extract( $args, EXTR_SKIP );
$title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Ephemera' ) : $instance['title'], $instance, $this->id_base); $title = apply_filters( 'widget_title', empty($instance['title']) ? __( 'Ephemera' ) : $instance['title'], $instance, $this->id_base);
if ( ! isset( $instance['number'] ) ) if ( ! isset( $instance['number'] ) )
$instance['number'] = '10'; $instance['number'] = '10';
if ( ! $number = absint( $instance['number'] ) ) if ( ! $number = absint( $instance['number'] ) )
$number = 10; $number = 10;
@ -73,33 +73,33 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
$ephemera->query( $ephemera_args ); $ephemera->query( $ephemera_args );
if ( $ephemera->have_posts() ) : if ( $ephemera->have_posts() ) :
echo $before_widget; echo $before_widget;
echo $before_title; echo $before_title;
echo $title; // Can set this with a widget option, or omit altogether echo $title; // Can set this with a widget option, or omit altogether
echo $after_title; echo $after_title;
global $post; global $post;
?> ?>
<ol> <ol>
<?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); ?> <?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); ?>
<?php if ( 'aside' == get_post_format( $post->ID ) ) : ?> <?php if ( 'aside' == get_post_format( $post->ID ) ) : ?>
<li class="entry-title"> <li 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> <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>
<span class="comments-link"> <span class="comments-link">
<?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?> <?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?>
</span> </span>
</li> </li>
<?php elseif ( 'link' == get_post_format( $post->ID ) ) : ?> <?php elseif ( 'link' == get_post_format( $post->ID ) ) : ?>
<li class="entry-title"> <li class="entry-title">
<?php <?php
$link_url = get_permalink(); $link_url = get_permalink();
if ( false != twentyeleven_url_grabber() ) if ( false != twentyeleven_url_grabber() )
$link_url = twentyeleven_url_grabber(); $link_url = twentyeleven_url_grabber();
?> ?>
@ -108,15 +108,15 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
<?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?> <?php comments_popup_link( __( '0 <span class="reply">comments &rarr;</span>', 'twentyeleven' ), __( '1 <span class="reply">comment &rarr;</span>', 'twentyeleven' ), __( '% <span class="reply">comments &rarr;</span>', 'twentyeleven' ) ); ?>
</span> </span>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php endwhile; ?> <?php endwhile; ?>
</ol> </ol>
<?php <?php
echo $after_widget; echo $after_widget;
// Reset the global $the_post as this query will have stomped on it // Reset the global $the_post as this query will have stomped on it
wp_reset_postdata(); wp_reset_postdata();
@ -143,10 +143,10 @@ class Twenty_Eleven_Ephemera_Widget extends WP_Widget {
return $instance; return $instance;
} }
function flush_widget_cache() { function flush_widget_cache() {
wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' ); wp_cache_delete( 'widget_twentyeleven_ephemera', 'widget' );
} }
/** /**
* Displays the form for this widget on the Widgets page of the WP Admin area. * Displays the form for this widget on the Widgets page of the WP Admin area.