Pretty simple question.

I have the 'blog' on my site set via 'reading' to be the page 'blog' located at mysite.com/blog. /blog is hierarchical, in that it has children.

I have a custom side bar that I include via a function in functions.php that does a simple include (ie: function get_right_sidebar() { include('sidebar_right.php) }; ). I list all pages and children via a simple function:

function get_post_top_ancestor_id(){
    global $post;

        $ancestors = array_reverse(get_post_ancestors($post->ID));
        return $ancestors[0];

     return $post->ID;

Followed by:

    <ul class="clearfix">
        <?php wp_list_pages( array('title_li'=>'','include'=>get_post_top_ancestor_id()) ); ?>
        <?php wp_list_pages( array('title_li'=>'','depth'=>1,'child_of'=>get_post_top_ancestor_id()) ); ?>

In the actual page template sidebar_right.php

Now, this navigation bar works completely fine, accept when I navigate to the base-level /blog. Nothing shows up in the sidebar.

After doing a global $post; print_r($post)in the sidebar_right.php I see that it is listing a post as the query, instead of page (and therefore is not getting the child pages to list in the sidebar).

I tried tossing in a wp_reset_query, but it did nothing.

Can anyone recommend what I should do in order to restore my navigation bar on my /blog section?



1 Answer 1


The problem when you set a 'page' as the blog roll through the back-end is that it automatically assigns the page as an 'archive'.

In order to solve the problem, I removed this option (ie: set blog roll to --Select--). I set the page to it's own custom template and made a custom query feed, so I could utilize wp_reset_query(). This then restored the functionality and my right sidebar navigation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.