WordPress.org

Forums

Page list with description but current_page_item not working. (1 post)

  1. ryezack
    Member
    Posted 4 years ago #

    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 desc

    I 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(); ?>

  2. " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
    <?php the_title(); ?>

    <span><?php echo get_post_meta($post->ID, 'description', true); ?></span>
  3. <?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: http://www.inventivewebs.net/wp-sample/

    Please help. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags