Thanks for reporting this — I’ll take a look and let you know what I come up with.
I just published a fix for this in v1.3.1 — let me know how it works for you.
I think there’s an error in the logic that was implemented in 1.3.1 due to this thread. The output is incorrect. If we take one of these examples:
<li>Menu 1</li>
<li>Menu 2
<ul>
<li>Foo</li>
</ul>
</li>
according to what was mentioned above and what it looks like it’s doing on the list output it’s doing this:
<li class="first">Menu 1</li>
<li>Menu 2
<ul>
<li class="first last">Foo</li>
</ul>
</li>
Which even this is close but not correct IMO. It should be:
<li class="first">Menu 1</li>
<li class="last">Menu 2
<ul>
<li class="first last">Foo</li>
</ul>
</li>
But even after that suggestion here’s what the current output is doing:
<li class="first">Menu 1 <!-- correct
<ul>
<li class="first last">Foo</li> <!-- wrong
<li>Bar</li>
<li>X</li>
<li>Y</li>
<li>Z</li> <!-- wrong
</ul>
</li>
<li>Menu 2
<ul>
<li class="first last">Foo 2</li> <!-- wrong
<li>Bar 2</li>
<li>X 2</li>
<li>Y 2</li>
<li>Z 2</li> <!-- wrong
</ul>
</li>
<li>Menu 3
<ul> <!-- wrong
<li class="first last">Foo 3</li> <!-- correct
</ul>
</li>
which is wrong. It should be showing:
<li class="first">Menu 1
<ul>
<li class="first">Foo</li>
<li>Bar</li>
<li>X</li>
<li>Y</li>
<li class="last">Z</li>
</ul>
</li>
<li>Menu 2
<ul>
<li class="first">Foo 2</li>
<li>Bar 2</li>
<li>X 2</li>
<li>Y 2</li>
<li class="last">Z 2</li>
</ul>
</li>
<li class="last">Menu 3
<ul>
<li class="first last">Foo 3</li>
</ul>
</li>
the two classes “first last” should only ever show up on an item that has <= 1 sibling. what it’s doing now is showing “first last” on the first item of every single first sibling. I started to mess with it but the string reversing is wiggin me out LoL.
This should also be better in the 1.3.2 update — let me know if it works for you.
Thread Starter
iron77
(@iron77)
Hi guys, soz for my long absence here, I’ll try to help you on this from now on 🙂
Let me show you some test results which I made on the lastest 1.3.2 version of the plugin (running on latest WordPress 2.9.1).
And before that just quickly consider how wp_list_pages might be called. In exmaple:
wp_list_pages('child_of=123&title_li=');
The thing is “title_li=” parameter, which can be set empty (and it a common use at many plugins) or have a value. The main diffrence is, when you put someting there, there’s a “root” [li][ul]..[/ul][/li] around the output itself, and if it’s empty you just get 1st lvl LIs straight. I don’t know if you considered both options but I obverved slightly diffrent bevahiour of your filters when its empty and not.
Example 1.
I’m calling wp_list_pages this way:
wp_list_pages('child_of='.$top_page.'&title_li=&echo=0');
..so NO root [li][ul]..[/ul][/li].
Preety simple exmaple, with not much elements, have a look: http://nbm.im/2010-01-18_2107.png
Here’s the same thing with “title_li= ” (set to space)
http://nbm.im/2010-01-18_2127.png
Example 2.
Menu with some more items:
title_li off http://nbm.im/2010-01-18_2132.png
title_li on: http://nbm.im/2010-01-18_2143.png
Exmaple 3.
Same as previous, but with an additional without-children page at the end:
title_li off: http://nbm.im/2010-01-18_2153.png
title_li on: http://nbm.im/2010-01-18_2201.png
If you like to throw un-filtered version of my examples through some kind of regex testing software (my friend was always praised “RegexBuddy”), here’s the wp_list_pages outputs of all examples when plugin turned off
http://nbm.im/classy_list_pages_examples/
Just subscribed to this topic so I’ll try to keep in touch – pls tell me if you need any testing etc 🙂
Thx