You can accomplish this in at least two ways:
1) Via CSS. Use the appropriate class selectors (e.g. current-page-item, current-page-parent, current-page-ancestor) to display the appropriate sub-menu.
2) Separate calls to wp_list_pages(). The first call will have a depth=1 argument passed, and the second will determine the ID of the current parent page, and output accordingly, using the “child_of” argument, e.g.:
<?php
global $post;
$current_page_parent = ( $post->post_parent ? $post->post_parent : $post->ID );
wp_list_pages( array(
'title_li' => '',
'child_of' => $current_page_parent,
'depth' => '1' )
);
?>
There are probably other ways, as well.
Related Posts:
- How do I add support to my theme for custom menus?
- Any official way to create an admin theme?
- Creating Multiple Menus when using the TwentyTen Theme?
- How to find out if page_for_posts is showing (in order to style menu item)
- How to create different navigation for registered users in WooThemes Canvas?
- How to remove the tripadvisor logo from the wordpress theme?
- Make a menu item unselectable
- Custom theme – pages in menu
- Theme Options Menu Item – Permission Issue
- Lightword Theme – only one menu item
- how to add version of style.css in wordpress
- How to set thumbnail image for a (child) theme
- Categorising themes by folders in backend
- Is it possible to stop a theme activation when a certain plugin is not activated
- add image size still doesn’t work even after regenerating thumbnails
- Best location for theme translation files
- WordPress themes under GPL license
- How can I customize the search results in Bones theme?
- How to develop a theme while having another show up
- When does WordPress wrap inline scripts in CDATA?
- Switch to other theme at URL
- How to go about pre generating css file with variables from theme options
- How to load a different theme for categories?
- Can I update themes without enabling maintenance mode?
- How to change sidebar per page?
- Add a series of checkboxes to theme options
- WordPress Theme Development Seemingly Awful Partitioning of Includes?
- Disable Theme API / Front end (for API only environment)
- Hide default “Recent Comments” Widget if there are no comments yet
- Showing post thumbnail (attachment) on the archive.php category listing
- Theme Check warning wrong direcory for theme
- Static page not working
- Add more widget areas to a theme
- Posts and Pages not showing on admin, but showing in theme
- Error defining a gutenberg block in a theme
- How can I add class to every quote element?
- Looking for a fully customisable WP responsive theme to develop a small scale fiverr type site for voice artists [closed]
- Page dissapears when i click save
- How to use command lines an activate theme in wp – cli also setup Vagrant/Sage Theme?
- Where am I doing wrong in my theme menu?
- How should I build a custom menu walker for this setup?
- Is wordpress big enough for my project [closed]
- What hook is the currently active theme’s functions.php file loaded on? [duplicate]
- How to get theme screenshot
- Theme doesn’t support shortcodes
- i would like to have 3 default columns editable in guttenberg
- Define theme information other than through style.css
- Change avatar on themed profile page
- How to get menu location in wp_update_nav_menu hook
- Trying to uninstall a theme, but it’s hijacking my home page
- WordPress 5.1 upgrade has lost the parent theme JavaScript
- Is it possible to open a page with a different theme?
- How to hide the menu item created by the theme in WordPress admin panel?
- How to add some php code in header.php using plugin
- WordPress Theme and Plugin Name extraction
- Create page options for theme?
- Where is the best place to catch useragent?
- Knowing blog name using blog id
- Alternative to Back End Dashboard?
- How can I change the prev / next buttons text to Dutch?
- Woocommerce single product image blurred and small. Actual image is big
- Adding a template in WPTouch
- one page wordpress theme
- Are the Theme frame works or Theme builders slow downs the performance? [closed]
- Make the “Add New Post” one column for all users
- What happened to my Inactive Widgets?
- How can I show some standard html code across any theme I install?
- Losing theme customization when switching from a theme to a child
- First click to blog title does not open the blog article
- Problem of not changing the front and bottom of the Woodmart template by activating the really simple ssl pro plugin in WordPress
- Please help me clear my confusions about WordPress
- Theme translation not working
- Custom homepage with recent blog posts
- Dynamic image for Jumbotron on WordPress Custom Theme
- How to implement theme option to change bootstrap 4 container from .container to .container-fluid
- use a Thumbnail size in post
- Why does WordPress Editor Only Use Half the Box?
- Transfer WordPress site to another domain
- 500 Internal Errors
- Installing Theme from uploaded file. Not uploaded theme?
- Strange Theme Error – parent style occasionally showing though child theme
- WordPress theme not updating in Other browsers
- Can i add wordpress editor to my custom theme option? [closed]
- Firebug and Chrome rendering two body tags
- Does WordPress provide themes_api function?
- Where do URI files come from?
- wp_nav_menu in 3.7 add name class nav navbar-nav
- How to show tags in posts with a theme that does not do it
- Converting HTML5 to XHTML
- Best way to include pagination in a theme [closed]
- What happens to bespoke page template references on theme change?
- How to remove header “ish” label [closed]
- How to change the standard width of a page
- register_nav_menus syntax error, unexpected identifier “register_nav_menus” in
- My theme is not translated
- Wrong theme being activated
- RTL in posts only [closed]
- Blocking Google Fonts in wordpress website
- I am unable to remove “© 2022 My Blog | PopularFX Theme ” from footer [closed]
- Workaround AJAX calling without directly calling WordPress backend (Admin dashboard) because it is restricted to the end user (the public)