The MU forums have moved to WordPress.org

How do I exclude child pages (8 posts)

  1. billdennis5
    Member
    Posted 17 years ago #

    I'm running a list of pages in my header using the following code:

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

    I want to exclude child pages from this list. I've tried several things, but I'm just not getting it.

    Any advice? Answers? Thanks in advance,

  2. andrea_r
    Moderator
    Posted 17 years ago #

    http://codex.wordpress.org/Template_Tags/wp_list_pages#Exclude_Pages_from_List

    <?php wp_list_pages('exclude=17,38' ); ?>

    Where 17 and 38 are the ID's of the pages you want to exclude.

  3. tdjcbe
    Member
    Posted 17 years ago #

    I'm thinking the poster is trying to exclude the child pages in general.

    Have to admit that depth=1 should work.

    What is happening? Is it displaying everything?

  4. andrea_r
    Moderator
    Posted 17 years ago #

    Some templates really mess up if you have child pages - is that what you mean, Bill?

    I usually add stuff to the stylesheet to make 'em drop-downs.

  5. billdennis5
    Member
    Posted 17 years ago #

    Actually, I have since discovered that in the template I am using right now, the child pages are not displaying. Which is good, because I didn't want them to, and I was under the impression they would. I would LOVE to insert code to make them show a drop down upon rollover. Any examples? I spent abut an hour going through the themes on my site trying to find one.

  6. andrea_r
    Moderator
    Posted 17 years ago #

    It's a bit of tricky css to wrap your head around at first.
    http://www.cssplay.co.uk/menus/dd_valid.html

    Mostly what I've been doing lately is find code that works for the basic theme I start with, then copy/paste it in the rest & tweak.

    No suckerfish plugin, no javascript. :D

  7. billdennis5
    Member
    Posted 17 years ago #

    I looks NICE. I'll try adapting.

  8. billdennis5
    Member
    Posted 17 years ago #

    OK, I added the above code to the style sheet and there's no change whatsoever.

    Coming to the conclusion this us above my pay grade and I am moving on .

About this Topic

  • Started 17 years ago by billdennis5
  • Latest reply from billdennis5