This is awesome, but it needs more. Can this be used as a sitemap or more specific list which can be narrowed down with the parameters, like with categories or specific dates? And how specifically can this be used? For those of us who would like to run it through some paces, we need a little more info.
By category, I mean a list of links in a specific category re: wp_list_pages('category=1') or something like that. When I get back to my office and off the road in another two weeks, I'll give these a try and see what happens. But if anyone else can come up with some tries before that - help is welcome!
Lorelle 16:57, 2 Feb 2005 (GMT)
Ah, here is some confusion. The example is:
Example 2 Displays no heading for list. <ul> <?php wp_list_pages('title_li= '); ?> </ul> Example 3 Displays no heading for list, and list is not wrapped in <li><ul>, </ul></li> tags. <ul> <?php wp_list_pages('title_li='); ?> </ul>
But I don't see a real change between the two example codes. So will php wp_listpages('title_li= ') give us no headings and the second one, with no space between the li and the apostrophe, give us a list without the li and ul? They basically look the same except for the space. Is something left out?
Lorelle 17:01, 2 Feb 2005 (GMT)
Lorelle 04:57, 4 Feb 2005 (GMT)
:)
--MDAWaffe 05:48, 4 Feb 2005 (GMT)I've been working on using this tag on my test site and I'm having some problems with some of the examples. Basically, it takes a lot of work to understand some of them. If they showed what the results might look like before the actual code, that would help.
I learned that the title_li= must be the LAST argument on the list. If you put it in the middle, it won't work right. Has anyone tried it in the middle of the arguments and had it work?
I'm having a heck of a time with the fact that the UL is embedded along with the LI. From what I understand on other similar tags, and as outlined in the example, the tag is put in place surrounded by opening and closing UL. This implies that the code results in just LI tags. Yet, when I do that, and include another tag above it, like this:
/* beginning of sidebar links */ <ul> <li><?php _e('Connect the Dots'); ?> <ul id="pageslist"> <li><a title="Lorelle's Blog " href="index.php?cat=7">Blog</a></li> <?php wp_list_pages('exclude=497&depth=1&&sort_column=menu_order&title_li= '); ?> </ul> </li> <li id="related"><?php _e('Related Articles'); ?> <ul><?php related_posts(10, 10, '<li>', '</li>', '', '', false, false); ?> </ul></li>....
Instead of all of the pages including the single link under one title, I get something that looks like this:
This is a prime example of how this tag will be used and if we are explaining this to folks, we need to explain that this tag looks and works differently from the other tags that list without their own UL. It works this way with the related_posts tag shown in the code above. Is there an arguments that determines if the UL is used or not?
Just trying to make this article as helpful as possible for the real world use. Lorelle 20:00, 23 Feb 2005 (GMT)
<li><ul>
./* beginning of sidebar links */ <ul> <li><?php _e('Connect the Dots'); ?> <ul id="pageslist"> <li><a title="Lorelle's Blog " href="index.php?cat=7">Blog</a></li> <?php wp_list_pages('exclude=497&depth=1&sort_column=menu_order&title_li='); ?> </ul> </li> <li id="related"><?php _e('Related Articles'); ?> <ul><?php related_posts(10, 10, '<li>', '</li>', '', '', false, false); ?> </ul></li>....
wp_list_pages('exclude=497&depth=1&title_li=&sort_column=menu_order');
wp_list_pages('exclude=497&depth=1&title_li= &sort_column=menu_order');
wp_list_pages('exclude=497&depth=1&title_li=ListTitle&sort_column=menu_order');
About Us
What's New
Contact Us
In other tags, like wp_list_cats(), you can control the separators between the different items, like instead of having LI tags, you can choose to have "/" or "+" or whatever as a separator. Is it possible to do the same with wp_list_pages? (and i am not talking about just the header)
To get a contextual listing of subpages for the current page from within the Loop:
<?php if (is_page()) { ?> <ul> <?php global $id; wp_list_pages('child_of=' . $id . '&title_li='); ?> </ul> <?php } ?>
I'm using this to put a listing of sub-pages in a sidebar.
--Eads 17:11, 5 May 2005 (UTC)
Nearlythere 17:21, 13 Jul 2005 (UTC)
sort_column=time_modifed/created
no longer works in 1.5.1. I think post_modified and post_date work, but I'm not 100% positive they'll sort correctly. --MDAWaffe - Talk 04:20, 10 May 2005 (UTC)
I am trying to use the wp_list_pages tag twice within the same template to produce to distinct lists of pages under different titles. Below is the code I am using:
<?php wp_list_pages('exclude=2,3,4,5,6,7,8,9,10,11,12,13&title_li=' ); ?>
<?php wp_list_pages('exclude=31&title_li=' ); ?>
[NOTE: I have excluded the titles to isolate the problem]
The problem is that both tags generate the list of pages indicated for the first tag. If I switch the order of the tags, then the list of pages generated for both tags becomes the pages indicated in what was the second tag but is now the first.
Anyone have a thought on how to fix this?
Thanks!
It appears that the comment on the doc page regarding the requirement of having the exclude page id numbers in ascending order i.e. (1,2,3,4,10,20,30,40) as opposed to having a random order i.e. (4,40,2,1,20,3,10,30) is actually not an issue. Having looked at the source it appears the SQL that is generated is simply creating AND ID <> [ID] over and over again. This requirement seems to be unnecessary and I think this should be removed from the documentation.
Comments? -Tim Gallagher 29 Jan 2007
Thankfully, I found it looking through the sections here, but a mention of how to use multiple parameters would be useful. I was attempting to use commas as I thought had been suggested.
I had tried to use
<?php wp_list_pages('exclude=34' 'title_li=<h2>' . __('Other Pages'). '</h2>'); ?>
which resulted in the title being ignored, or when transposed, the exclusion was ignored. I only found here that I have to use & to connect parameters, giving me
<?php wp_list_pages('exclude=35&title_li=<h2>' . __('Other Pages'). '</h2>'); ?>
I'd have saved a solid hour if there was a mention of that in the article, it seems like there should be, it's a critical piece of information.--ZekeDMS
It appears to me that in 2.5.1 and 2.6 (and perhaps earlier) the default sort order is not 'title', but 'menu_order'.
For 2.6 see http://wp0806.sgtst.com/ with the default theme and the list of pages in the sidebar generated with the code:
wp_list_pages('title_li=<h2>Pages</h2>')
and the list of pages shown as:
* Page #10 * Another #20 * About #30
where the numbers above are the page orders assigned in the Write > Page panel. But see http://wordpress.org/support/topic/190220?replies=4 where this is not working this way for a newbie.
--Converting2wp 17:36, 22 July 2008 (UTC)