As wp_list_pages()
has an argument of walker
, you can use that to replace what is being used by walk_page_tree()
as walker class internally.
@Brady has left a nice example in this answer.
class WPSE113482PageWalker extends Walker_Page
{
function start_el( &$output, $page, $depth, $args, $current_page )
{
// Build $output here and apply your class for the active item
}
}
You might also want to consider using wp_page_menu()
.
Related Posts:
- Load parent pages when there are no child pages
- How can I hide children of draft pages using wp_list_pages()?
- Child Pages Loop
- How to List All Pages (With their template names) Within a Website
- How can I list all pages with their templates?
- Add Parent to List of Subpages
- get all page IDs from wp_list_pages
- how to properly list child pages in sidebar?
- Display grandchildren on child and grandchild pages using wp_list_pages
- create shortcode to show children if any otherwise siblings
- inserting custom li class to wp_list_pages
- How to get a list of all recently published child pages?
- dynamically limit depth of wp_list_pages
- Conditional styling of wp_list_pages bullet points [closed]
- Setting multiple values to as sort_column
- wp_list_pages – Using a Walker to customize output order
- List child pages of specific page using shortcode
- Custom category listings
- How can I include private pages in a page list?
- Do Not Display Parent Page if No Subpages
- Arrange Combined List of Pages and Categories
- List pages within a certain parent and show published month
- How to get specified parent page title in my function
- Show siblings (if any) and parents
- Change Parent Name with wp_list_pages?
- List all Posts under heading in wp_list_pages menu
- List all-childpages on parent-page AND list child-pages on childpage itself but not the current one?
- List child pages by slug not ID?
- $item->url not retrieving url in custom walker?
- Menu with parents, children and or siblings pages display
- Append a code when at the current page in wp_list_pages()
- Combining ‘depth’ with ‘include’ in wp_list_pages()
- WordPress Side Navigation with Parent Heading and Child Sub Pages
- List subpage of subpage
- wp_list_page with something like showpost
- How can I list all page titles and IDs?
- Hide Parent if No Children
- Add Parent to Subpage List
- active parent page when clicked on childpage
- Keep page hierarchy in wp_list_pages, even if on a child or grandchild
- Sort and display pages with specific custom field (not tag)
- Dynamic menu wp_list_pages displaying only current branch including: current page, his siblings and its childs
- alternating classes on wp_list_pages
- remove auto generated pages from the menu?
- How to use wp_list_pages on a grandparent page
- Inset image thumbnail from page into list
- How to prevent custom walker from creating sub navigation for pages that are not relatives of the current page?
- Exclude current page in wp_list_pages
- Sub Navigation in Sidebar
- Check if page has subpages
- wp_list_pages bug in “number” parameter
- Targeting specific instane of wp_list_pages
- Creating navigation out of specific IDs and their children?
- Create a list of pages excluding children of selected page
- Renaming wp_list_pages class
- Listing Child Pages in Random order
- wp_list_pages issue/bug?
- PHP: Why does my code work in index.php but not a widget?
- Why is wp_list_pages altering $post->ID of the page?
- WordPress get_pages sub nav show current page
- Change class name in WordPress wp_list_page nav
- Get current post’s child page?
- Non page link in wp_list_pages
- How to make in post Parent page children page list nummbered
- only display Pages which have children
- add a.parent in wp_list_pages
- wp_list_pages by taxonomy?
- wp_list_pages Format only on Recently Modified Pages
- Adding custom class names to anchor in wp_list_pages
- Walker Class : extract function and wp_list_pages
- Exclude pages by custom field (with yes/no) storing wrong data?
- How to specify a class added to my gallery
- Breadcrumbs showing Parent and Child Pages
- Get parent category class in post_class()
- Display subpages under parent page as a list within a loop
- Ways to give a wp_list_pages menu link specific class names?
- Do not show child pages of child pages
- Adding span tags within wp_list_pages list items
- Show child pages when on a child page
- query attachment images … if no attachments -> get attachments of parent page?
- Hierarchical Custom Posts – Highlighting Current Post in Sub-Menu
- Search pages that are a child of the current page
- Child page menu in sidebar
- Parent/child pages and link structure the right way
- How to remove the HOME menu item
- Active Menu Highlighter with Subpages?
- wordpress add field to post_class
- Add ID to target navigation link
- Listing Sub-Pages & Sub-Sub-Pages
- If/Else child list for Custom Post Type single template within loop?
- Search anything from a Child and Sub-Pages of their Parent page
- Where to use Post class in a real theme, title, content or parent div or article tag?
- How do I find out which (page) template file my custom child post is looking for?
- Post List by category and under custom taxonomy
- Displaying Child Page’s Information
- How to perform str_replace on the results of wp_list_pages
- Childpage title + content on Parent Page
- Showing Custom Menus in the sidebar
- Query sub subpages based on specific date?
- Making current_page_item work with wp_list_pages in sidebar on post pages