Forum Replies Created

Viewing 1 replies (of 1 total)
  • Not sure if this belongs here, but I spent an entire week trying to find what I needed (and I thought is was SO simple).

    On my site I have one sidebar on all pages but to keep things clear, I only want the top level pages to show there. That was easily done with:

    <ul><?php wp_list_pages('title_li=&depth=1'); ?></ul>

    Now on every page, I wanted to show only it's direct children. That's done by giving the above code the child_of parameter. Unfortunately it seemed impossible to get the page's ID. the_ID() ECHOES the post/page ID. Well, to cut a long story short, what eventually worked for me was this:

    <ul>
    <?php $current_page_id = $wp_query->post->ID;
    wp_list_pages("title_li=&child_of=$current_page_id&depth=1"); ?>
    </ul>

    I put all of the IN the loop.

Viewing 1 replies (of 1 total)