Im cutting a template I got built into wordpress, im having difficulty with the menu, I need to have the first list item( <li>
) that is returned from the wp_list_pages function to have value="1" in the tag as well so the jquery menu starts there, therefore would be the first item
views:
25answers:
3
A:
Maybe wordpress codex helps you: http://codex.wordpress.org/Function_Reference/wp_list_pages
rlbisbe
2010-08-26 12:25:38
A:
You'd better user get_pages (http://codex.wordpress.org/Function_Reference/get_pages) so you can write your own wrapper.
If you want to focus the first navigation item with jquery, you can do it like this:
$('ul#nav li:first')
joggink
2010-08-26 12:28:44
A:
I would just use PHP string manipulation methods to replace the first instance of found text with a modified version of it. For example:
<?php
$navStr = wp_list_pages('title_li=&depth=2&sort_column=menu_order&echo=0');
$navStr = preg_replace('/<li class="/i', '<li value="1" class="', $navStr, 1);
echo $navStr;
?>
bhamrick
2010-08-26 17:14:57