Page list with description but current_page_item not working.
-
Hi.
I want my page list navigation menu to display each page custom field ‘description’ together with the page list menu:
Page title: | Home | About | Blog
Page description: | Home description | About description | Blog descI have replaced the wp_nav_menu of twentyten theme and applied these codes to header.php and it worked.
<?php
$args=array(
‘orderby’ => ‘title’,
‘post_parent’ => 0,
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => -1,
‘caller_get_posts’=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
// List of Pages (just parent pages)
while ($my_query->have_posts()) : $my_query->the_post(); ?>-
” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”>
<?php the_title(); ?><span><?php echo get_post_meta($post->ID, ‘description’, true); ?></span>
<?php endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>Just one problem, the current_page_item css feature of wordpress isn’t working.
Here’s my site: https://www.inventivewebs.net/wp-sample/
Please help. Thanks.
-
” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”>
- The topic ‘Page list with description but current_page_item not working.’ is closed to new replies.