• I was hoping can some one help me in a adding a class “dropdown” to all the list items that has subpages below them when i call wp_list_pages

    eg.

    <ul>
    <li class="page_item page-item-2"><a href="#">main 1</a></li>
    <li class="dropdown page_item page-item-4"><ahref="#">main 2</a>
    <ul class="children">
    	<li class="page_item page-item-6"><a href="#">Sub 1</a></li>
    	<li class="page_item page-item-9"><a href="#">Sub 2</a></li>
    </ul>
    </li>
    </ul>

    please help

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t know what you want to do, but, in order to add a special style to all list items that have a parent you could use the following in a stylesheet or Javascript :
    .children .page_item

    Thread Starter carbonr

    (@carbonr)

    what i want to do is:

    -show a small arrow for those menu items that has sub menus (pages)
    -for this i need an additional class to be added by wordpress whenever there is a subpage

    Hi carbonr,

    There are many option for this, but the custom solution is:
    Copy the following function/class in your function.php. (/wp-content/themes/your_theme/function.php) and use name related to your theme or site.
    wp_list_pages(); //function
    walk_page_tree(); //function
    Walker_Page(); // class

    Now it will implement only on your theme. You can make any lavel of customisation in this.

    Enjoy !

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding extra class to li item with sub pages’ is closed to new replies.