我希望在呈现导航时,包含类“current_page_item”的元素位于顶部,是否可以在wordpress中这样做?如果是的话,也许你可以帮我解决…
<div class="sidebar">
<?php
if ( is_page() && $post->post_parent ) {
$args = array(
'order' => 'ASC',
'post_parent' => $post->parent,
'post_status' => 'publish',
'post_type' => 'page'
);
$children = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' );
}
else {
$children = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' );
$args = array(
'order' => 'ASC',
'post_parent' => $post->ID,
'post_status' => 'publish',
'post_type' => 'page'
);
}
if ( $children) : ?>
<ul class="sidebar-list">
<?php echo $children; ?>
</ul>
<?php endif; ?>
</div>