Support » Fixing WordPress » wp_list_pages – Options?

  • I saw that wp_lists_pages is available in the latest nighly build (I
    was surprised, I never knew it existed). Now I’ve been scrambling to
    figure it out and can’t really find any documentation on it.

    I guess I’m just the type of impatient person who finds something like
    this and wants to roll with it. I tried tweaking the template line to
    get it to only show “1” depth level and changed it to read:

    ‘<?php wp_list_pages(‘title_li=<h2>’ . ‘depth=1’ . __(‘Pages’) . ‘</h2>’ ); ?>’

    and it did nothing. (I was hoping it would just show the “top level” pages… for instance:

  • home
  • portfolio
  • photos
  • and not

  • home
  • portfolio
  • photos
  • <ul submenu>

  • cycling
  • weddings
  • Does that make sense?

Viewing 9 replies - 1 through 9 (of 9 total)
  • NOTE: This template tag is still in flux. The options may change without warning, and these options may no longer be supported. No effort will be made by the developers to make the eventual version of this template tag backward compatible with the current version.

    @motoed: You’re not passing your arguments right:


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

    for starts. I’m not sure what the rest the stuff you’re trying to do is.

    @nuclearmoose, I don’t think he got far enough to see the warning. I was waiting for Kafkaesqui to look it over before actually giving out the link.

    Yes, that’s why I didn’t give out the link, only supplied the warning. 🙂

    Ah – 😉

    I understand guys…and I realize that I’m probably jumping the gun on this. I’m just anxious to get this working. I googled some link to the function to listed the options for it.

    Which is where I found the Depth=1 (which I assume will only show the top level pages and not the subpages.)

    mdawaffe – The other stuff that you aren’t sure if I’m trying to do, is part of the “current” (as of a coupel days ago) code for that. I just tried to find a place to “add” the depth option to what was already listed in the template.

    Sorry, I didn’t see that Kubrick was doing things so… oddly. Sort of an interesting semantics vs. practicality of coding issue. Actually… I think it could be made a lot easier with some CSS2 before’s and after’s. But nevermind, that’s beside the point; ignore it.

    If you want it styled the same as your other lists without getting into Kubrick’s CSS, try

    <?php wp_list_pages('title_li=<h2>' . __('Pages') . '</h2>&depth=1' ); ?>

    Thank you. That took care of what I was looking for it to do.

    Does anyone know, Is there an official place where I can post a “feature request” for this function?

    I have two ideas I think many people would find beneficial, but I have no idea how to make them happen.

    1) When selecting a “page” and you go to the page, the submenu expands (I might be able to figure this one out in my template…. I can probably do this for my site, because I only have ONE page witha submenu, so in my sidebar I could an “is_page” function to toggle the subs on and off…. but if I had more, it would be much more complex)

    2) A way to “order” my pages. Right now, they only display in chronological order. (again, I assume this would be done with the custom Fields somehow.)

    I really need to bone up on PHP so I can actually dig in and help out!

    Thanks for all the help (and warnings)

    1. Yes, it can be done with templates. It should be possible for a template to figure out which page it’s displaying and only show subpages of that page.

    2. This can be done. Again, preliminary docs are in the works. And again, features may change.

    I just tried to use wp_list_pages(‘depth=1’) and it does not show the sub-pages of a page at all. Any idea why?
    Within wp_list_pages() definition, i don’t find any use of the depth variable, so is this function already deprecated, and if yes, how can this function be archived?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘wp_list_pages – Options?’ is closed to new replies.