Support » Themes and Templates » Nav Menu on Posts page

  • I am using WP more as a CMS, then as a blog. I have added a bunch of pages, and under:
    Front page displays:
    – Front page: [I selected my “home” page]
    – Posts page: [I selected my “Announcements” page]

    My header.php calls a list_secondary_nav() function in my function.php.

    function list_secondary_nav($return = 0) {
    global $wpdb, $post;
    $current_page = $post->ID;
    // Note: $current_page is the ID of the latest Post (not the Announcements page
    while($current_page) {
    $page_query = $wpdb->get_row(“SELECT ID, post_title, post_parent FROM $wpdb->posts WHERE ID = ‘$current_page'”);
    $current_page = $page_query->post_parent;
    $parent_id = $page_query->ID;
    $parent_title = $page_query->post_title;
    if($wpdb->get_results(“SELECT * FROM $wpdb->posts WHERE post_parent = ‘$parent_id’ and post_type = ‘page’ AND post_status = ‘publish’ “)) {
    echo'<ul id=”navSec” class=”group”>’;
    $html = wp_list_pages(“child_of=$parent_id&depth=$depth&echo=”.(!$return).”&title_li=0&sort_column=menu_order”);
    if($return) {
    return $html;
    } else {
    echo $html;

    The issue is when I click the Announcements link in the secondary Nav menu, the page I end up on (index.php I think) does not show the secondary Nav.

    What I want is that the page specified in Settings | Reading | Front page displays | Posts page, will display all the posts (like index.php), but show the navigation as though it is the page.

    Is this possible?

    Note: I tried creating an “Announcements” template which would get all the posts, but it doesn’t appear a page can get the posts.


  • The topic ‘Nav Menu on Posts page’ is closed to new replies.