• Hi!

    I’ve added this piece of code into the content of page.php to display child pages of the particular page.

    <?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&depth=1'.'&echo=0');
    if ($children) { ?>
    <div id="singlemenu">
    <div id="singlepagesmenu">
    <ul class="menu">
    <?php echo $children; ?>
    </ul>
    </div>  <!--END: pagesmenu-->
    </div>  <!--END: menu-->
    <?php } ?>

    It works perfectly, always displaying the next children of the particular active page. For example, when the About page is active, it shows the two child pages of the About page, eg About 1-1 and About 1-2. When I click on About 1-1, it displays that page’s children, eg About 1-1-1, About 1-1-2 and About 1-1-3.

    As soon as the current page is the last child (eg About 1-1-1) the menu disappears, which is also what I intended.

    NOW FOR THE TRICKY PART:

    I want to display the parent pages as soon as I reach the first child page. I’ve tried this:

    <?php $parent = wp_list_pages('title_li=&parent_of='.$post->ID.'&depth=1'.'&echo=0');
    if ($parent) { ?>
    <div id="singlemenu">
    <div id="singlepagesmenu">
    <ul class="menu">
    <?php echo $parent; ?>
    </ul>
    </div>  <!--END: pagesmenu-->
    </div>  <!--END: menu-->
    <?php } ?>

    The problem with that is that the MAIN MENU (eg HOME, ABOUT, BLOG, etc) is then also displayed. I don’t want that! What do I need to do to make the parent pages show up in a menu, but to exclude the top-order menu from showing up?

    I would really appreciate some help with this!

    Thank you!

    BTW: This piece of code comes from WP Recipes… Great source!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jacogriesel

    (@jacogriesel)

    Yeah…

    This might be the single problem I have with the Support forums. I know lots of people don’t even mind reading the codex – they just toss a question into the forum and hope for a quick fix.

    Whenever I read a question on the forum, I try to give a proper answer. Referring someone (who I good-heartedly assume already consulted the codex) back to the codex, is counter-productive. What’s the use of the forum then?

    Aren’t we suppose to share knowledge here? If somebody does the effort to post code and explain a problem being encountered, the least one can do is just ignore it. If you have to react, then react in the spirit of a support forum.

    apljdi – this remark is not intended as a personal attack. I’m a total n00b regarding coding themes in WordPress, and I’ve taken it upon myself to consult all documentation available and exhaust webwide searches before showing my lack of knowledge by asking a question on a forum. But sometimes the answer is just not that obvious. And, as I’ve been learning, I’ve been sharing my knowledge with other newcomers. It’s just that I’ve noticed members of this forum really like to give people a snotty, off-hand answer before, and if, they really try to help.

    Come on, people! WordPress is open-source. Let’s share our knowledge in that spirit. By acting as a know-it-all dismissive wise-ass you only hurt the spirit of open-source. Think about that before giving someboy with a legit question an answer like “read the codex” or “go google it”. That’s not what this support forum was meant to be.

    And if this ranting pisses some people off, so be it. Maybe it’s time then to do a little soul-searching.

    Back on the topic: after consulting the codex, after lots of googling, and after hours of tinkering with the code as supplied at the top, I still haven’t found an answer to my question. If somebody would be kind enough to examine my code and make concrete suggestions, I would appreciate it.

    Thanks!

    Precisely why i’ve never asked a question here. No need to treat people like idiots just because they dare asking a question.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pages Menu Hack – HELP NEEDED PLEASE!’ is closed to new replies.