Make WordPress Core

Changeset 26577


Ignore:
Timestamp:
12/03/2013 06:46:02 PM (13 years ago)
Author:
lancewillett
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/inc/widgets.php

    r26556 r26577  
    7676         */
    7777        public function widget( $args, $instance ) {
    78                 // If called directly, assign an unique index for caching.
    79                 if ( -1 == $this->number ) {
    80                         static $num = -1;
    81                         $this->_set( --$num );
    82                 }
    83 
    84                 $content = get_transient( $this->id );
    85 
    86                 if ( false !== $content ) {
    87                         echo $content;
    88                         return;
    89                 }
    90 
    91                 ob_start();
    92                 extract( $args, EXTR_SKIP );
    93 
    9478                $format = $instance['format'];
    9579                $number = empty( $instance['number'] ) ? 2 : absint( $instance['number'] );
    … …  
    116100                        $GLOBALS['content_width'] = 306;
    117101
    118                         echo $before_widget;
     102                        echo $args['before_widget'];
    119103                        ?>
    120104                        <h1 class="widget-title <?php echo esc_attr( $format ); ?>">
    … …  
    210194                        <?php
    211195
    212                         echo $after_widget;
     196                        echo $args['after_widget'];
    213197
    214198                        // Reset the post globals as this query will have stomped on it.
    … …  
    218202
    219203                endif; // End check for ephemeral posts.
    220 
    221                 set_transient( $this->id, ob_get_flush() );
    222204        }
    223205
Note: See TracChangeset for help on using the changeset viewer.