wordpress list pages function
Im cutting a template I got built into wordpress, im having difficulty 开发者_如何学Gowith 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
Maybe wordpress codex helps you: http://codex.wordpress.org/Function_Reference/wp_list_pages
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')
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;
?>
精彩评论