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?
- What’s the WordPress way to get custom HTML for child pages list (with a second relative link)? Currently running regex over wp_list_pages() output
- wp query to get child pages of current page
- How to mark every 3rd post
- Get parent page url to show up when it is in child pages
- Check if is on child-page of a particular page
- A check for if is parent page, if has children, if has grandchildren
- Can I have two child pages of different parents with the same name?
- How to specify a class added to my gallery
- Return parent post with its children using WP_Query?
- Remove WordPress theme from a specific page
- Create a “Dummy” parent page for a hierarchy in page listing?
- How To Limit Hierarchical Pages Depth (For Custom Post Types) To Children Only
- Advanced Custom Fields – Get custom fields from parent page
- Show just one level of child pages, wp_list_pages woe
- Automatically create child pages when saving a (parent) page
- Display a list of child posts on parent posts of a custom post type
- Allow only new sub-pages to be created
- 404 on child page when parent page slug is identical to custom post type
- Is there a default template file for child pages / subpages?
- Prev/Next child navigation for current page?
- Shortcode producing headers already sent error
- Get Permalink for the top level parent of child pages
- How can I programmatically create “child” pages on theme activation?
- Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]
- How to add classes to post_class?
- List child pages of a specific page
- Category as Class for Custom Post Type
- Keeping parent menu items active in child pages
- Highlighting current item of custom post types’ sub pages, listed by wp_list_pages