Make WordPress Core


Ignore:
Timestamp:
04/28/2011 09:47:30 AM (16 years ago)
Author:
nacin
Message:

In Twenty Eleven: Register the widget from functions.php. Kill create_function. Attach twentyeleven_widgets_init() to widgets_init, rather than init. Eliminate use of the $post global in the widget. see #17198.

File:
1 edited

Legend:

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

    r17723 r17738  
    7979                echo $after_title;
    8080
    81                 global $post;
    82 
    8381                ?>
    8482                <ol>
    8583                <?php while ( $ephemera->have_posts() ) : $ephemera->the_post(); ?>
    8684
    87                         <?php if ( 'link' != get_post_format( $post->ID ) ) : ?>
     85                        <?php if ( 'link' != get_post_format() ) : ?>
    8886
    8987                        <li class="entry-title">
    … …  
    117115                echo $after_widget;
    118116
    119                 // Reset the global $the_post as this query will have stomped on it
     117                // Reset the post globals as this query will have stomped on it
    120118                wp_reset_postdata();
    121119
    … …  
    163161        }
    164162}
    165 
    166 add_action( 'widgets_init', create_function( '', "register_widget( 'Twenty_Eleven_Ephemera_Widget' );" ) );
Note: See TracChangeset for help on using the changeset viewer.