Make WordPress Core


Ignore:
Timestamp:
03/26/2014 10:46:16 PM (11 years ago)
Author:
wonderboymusic
Message:

In wp_list_pages(), add the current_page_item class where applicable when used with a custom post type.

Adds a unit test.

Props nacin.
Fixes #17590.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r27682 r27755  
    10101010
    10111011        global $wp_query;
    1012         if ( is_page() || is_attachment() || $wp_query->is_posts_page )
    1013             $current_page = $wp_query->get_queried_object_id();
     1012        if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
     1013            $current_page = get_queried_object_id();
     1014        } elseif ( is_singular() ) {
     1015            $queried_object = get_queried_object();
     1016            if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
     1017                $current_page = $queried_object->ID;
     1018            }
     1019        }
     1020
    10141021        $output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
    10151022
Note: See TracChangeset for help on using the changeset viewer.