• Is there a way to show a list of child pages on the parent page and on the childpages, but NOT on any other page?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Odenberg

    (@murmelin)

    I have gone through that over and over. But I cant seem to find the right solution.

    I have no problem with listing the childpages. It puting the list on just that specific parent page and its children and not on any other pages that causes me grey hairs.

    I tried by adding ‘exclude’ to the call for the list. It would be a okey solution if I did′nt have a news section. I would prefer not to have to go in to the code and add a new page-ID to the exclude list, everytime a make a new post.

    Is there any “show only on page-IDno.X and its children”-code I could use?

    The solution esmi listed will accomplish that. Please post a link to the page you want it on and we’ll see if we can whip up an answer for you.

    I haven’t heard back, so I’m going to take a guess at what you’re trying to accomplish.

    You can take the code you already have in place, based on your other post from yesterday:

    <div id="page-list">
    
          <?php wp_list_pages('child_of=9& exclude=539,540 title_li='); ?> 
    
    </div>

    Then wrap it in a conditional statement that checks to see if you are currently on that page or one of it’s children. An example that may work would be:

    <?php is_page(array(42,'Murmelins-Parent-page','Murmelin's Parent Page')){
    ; ?>

    Then insert your list pages query, and close out the conditional statement with:

    `<?php } ?>

    I haven’t tested this code, but in theory it accomplishes what I understand your goal to be. If this doesn’t work, post back a link to your site and some more details and we’ll see if we can help.

    Thread Starter Odenberg

    (@murmelin)

    Thanks a lot for tring to help me, Oturia!

    Had to leave the computer for a couple of ours, children to feed and put to bed ??

    Any way, now Im back.

    Is this what you suggest me to do?

      <?php is_page(array(42,’webshop’)){; ?>
      <?php wp_list_pages(‘child_of=9& title_li=’); ?><?php } ?>

    Here is my webpage:
    bastardforlag.se/webshop

    Thanks agai for taking time to help me. I really appriciate it!

    Yes, though you may want to add the child pages to the array. You don’t have to list the same page twice, just list the array of page ids or names you want it to show on.

    <?php if ( is_page(array('webshop', 'Kassa', 'Varukorg', 'etc'))){; ?>
    <?php wp_list_pages('child_of=9&title_li='); ?>
    <?php } ?>

    That should do the trick. let me know if it doesn’t.

    Thread Starter Odenberg

    (@murmelin)

    The thing is that there are also other pages that will be added as child-child-pages.

    Is there a way to show the list at the parent page and all of its descendents?

    How about this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter Odenberg

    (@murmelin)

    Oh, the code have been removed. Could you please sent it again?

    The code was way too long, apparently. I should’ve known better.

    Try this link. I added the code there to the pastebin.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Add a UL of child pages?’ is closed to new replies.