WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/31/2010 11:02:17 AM (9 years ago)
Author:
scribu
Message:

use get_queried_object() wrappers throughout. See #14015

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r16029 r16114  
    856856 */
    857857function get_tag_template() {
    858     global $wp_query;
    859 
    860     $tag = $wp_query->get_queried_object();
     858    $tag = get_queried_object();
    861859    $tag_name = $tag->slug;
    862860    $tag_id = $tag->term_id;
     
    962960 */
    963961function get_page_template() {
    964     global $wp_query;
    965 
    966     $id = (int) $wp_query->get_queried_object_id();
     962    $id = get_queried_object_id();
    967963    $template = get_post_meta($id, '_wp_page_template', true);
    968964    $pagename = get_query_var('pagename');
     
    970966    if ( !$pagename && $id > 0 ) {
    971967        // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
    972         $post = $wp_query->get_queried_object();
     968        $post = get_queried_object();
    973969        $pagename = $post->post_name;
    974970    }
     
    10191015 */
    10201016function get_single_template() {
    1021     global $wp_query;
    1022 
    1023     $object = $wp_query->get_queried_object();
     1017    $object = get_queried_object();
    10241018    $templates = array('single-' . $object->post_type . '.php', 'single.php');
    10251019
Note: See TracChangeset for help on using the changeset viewer.