Twenty Fourteen: remove transient usage in Ephemera widget to fix caching issues. Props obenland, closes #26210 and #26335.

Built from https://develop.svn.wordpress.org/trunk@26577


git-svn-id: http://core.svn.wordpress.org/trunk@26468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-12-03 18:47:09 +00:00
parent 446d929e80
commit c2bf2c73c6

View File

@ -75,22 +75,6 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
* @return void Echoes its output.
*/
public function widget( $args, $instance ) {
// If called directly, assign an unique index for caching.
if ( -1 == $this->number ) {
static $num = -1;
$this->_set( --$num );
}
$content = get_transient( $this->id );
if ( false !== $content ) {
echo $content;
return;
}
ob_start();
extract( $args, EXTR_SKIP );
$format = $instance['format'];
$number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] );
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? $this->format_strings[ $format ] : $instance['title'], $instance, $this->id_base );
@ -115,7 +99,7 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
$tmp_content_width = $GLOBALS['content_width'];
$GLOBALS['content_width'] = 306;
echo $before_widget;
echo $args['before_widget'];
?>
<h1 class="widget-title <?php echo esc_attr( $format ); ?>">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"><?php echo $title; ?></a>
@ -209,7 +193,7 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
<a class="post-format-archive-link" href="<?php echo esc_url( get_post_format_link( $format ) ); ?>"><?php printf( __( 'More %s <span class="meta-nav">&rarr;</span>', 'twentyfourteen' ), $this->format_strings[ $format ] ); ?></a>
<?php
echo $after_widget;
echo $args['after_widget'];
// Reset the post globals as this query will have stomped on it.
wp_reset_postdata();
@ -217,8 +201,6 @@ class Twenty_Fourteen_Ephemera_Widget extends WP_Widget {
$GLOBALS['content_width'] = $tmp_content_width;
endif; // End check for ephemeral posts.
set_transient( $this->id, ob_get_flush() );
}
/**