php - Wordpress - Adding classes to wp_list_pages -


does know how edit/change wordpress's wp_list_pages function in order add classes ul , li items?

i'm trying implement new version of jquery.treeview requires <li class="expandable"> , <ul style="display: none;"> on expandable lists , child ul's.

i've been messing around aint working in applies 'expandable' class li's:

$pages = wp_list_pages('title_li=&echo=0' );         $pages = preg_replace('/class="/','class="expandable ', $pages); //note space on end of replacement string                           //output         echo $pages; 

and here outputted html should like:

<ul class="treeview" id="tree">          <li><a href="#">home</a></li>                    <li class="expandable"><a href="#">expand 1</a>             <ul style="display: none;">                 <li class="expandable"><a href="#">expand 2_1</a>                     <ul style="display: none;">                         <li><a href="#">expanded 3_1</a></li>                         <li><a href="#">expanded 3_2</a></li>                         <li><a href="#">expanded 3_3</a></li>                     </ul>                                        </li>                 <li class="expandable"><a href="#" >expand 2_2</a>                     <ul style="display: none;">                         <li><a href="#">expanded 4_1</a></li>                         <li><a href="#">expanded 4_2</a></li>                         <li><a href="#">expanded 4_3</a></li>                     </ul>                   </li>                                    </ul>   

hope makes sense , appreciated, s.

i guess trying activate tree view on page items. require javascript can add class using javascript before initializing tree view:

$("#tree li").addclass("expandable"); $("#tree").treeview(); 

if want hide ul elements can use jquery, (not sure correct syntax):

$("#tree ul").hide(); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -