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.



git-svn-id: https://develop.svn.wordpress.org/trunk@27755 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-03-26 22:46:16 +00:00
parent 8aeeaf976a
commit 09c4928cf7
2 changed files with 34 additions and 2 deletions
+9 -2
View File
@@ -1009,8 +1009,15 @@ function wp_list_pages($args = '') {
$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';
global $wp_query;
if ( is_page() || is_attachment() || $wp_query->is_posts_page )
$current_page = $wp_query->get_queried_object_id();
if ( is_page() || is_attachment() || $wp_query->is_posts_page ) {
$current_page = get_queried_object_id();
} elseif ( is_singular() ) {
$queried_object = get_queried_object();
if ( is_post_type_hierarchical( $queried_object->post_type ) ) {
$current_page = $queried_object->ID;
}
}
$output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
if ( $r['title_li'] )