To check for a specific parent ID use $post->post_parent=="123"
and replace “123” with the parent ID of your choice.
I learned how to do this by using the Widget Logic plugin. From the Widget Logic notes:
global $post; return (is_page('pagename') || ($post->post_parent=="13"));
— home page OR the page that’s a child of page 13
Edit: A better source is Testing for sub-Pages in the codex.
Related Posts:
- Auto add pages to primary menu with functions.php
- Programmatically add existing pages and subpages to Appearance Menu
- two different separate sections on the same site
- wp_list_pages Hierarchical Help
- Add pages content to startpage through custom menu
- How can I order these pages in this navigation bar on this old wordpress theme?
- Unable to remove page from primary menu
- How to add class and span to
- how can i get the page_ID in nav li [closed]
- Custom ID for certain menu item?
- Add data-icon input to WordPress custom menu links
- Show current navigation path from menu
- How to get current page menu item name instead of full menu item list
- Add class to active top level (grandparent) menu item
- How to get Menu Navigation Labels to output HTML
- custom menu not found
- wp_nav_menu doesn’t generate parent/ancestor classes
- How to add text before WordPress menu item href
- Add an extra field to the navigation menu box?
- How do i style the current menu anchor link’s parent anchor link? [closed]
- Does the menu item ID ever change?
- Hide and show menu subpages
- Benefits of using Nav Walker?
- Use walker for specific menu, or avoid use of walker
- Change where navigation bar links?
- wp_list_pages sort order is different for different languages [closed]
- list pages only from master parent
- has_children in custom nav_walker
- How to have custom menu Item CSS Classes for wp_page_menu() or wp_list_pages()
- How to fix “Supplied nav_menu_item value missing property” after update to WordPress 5.0
- Set if condition with wp_nav_menu
- wp_nav_menu including Skype URL
- Disable most recent & view all (TABS) on nav-menu.php
- Link to Homepage in Menu
- Change an li class name in a wordpress custom menu walker
- Separator for custom nav menu
- How do I add recent posts to the menu?
- Conditional secondary menus
- Determine the last child of the parent menu WP Nav Walker
- Nav and logo loading each time causing menu to move JointsWP – Foundation 6
- Navigation doesn’t render when wp is hosted
- Create custom page and add it in nav menu by code
- How to highlight 1st level menu item based on actual page
- Add span in top menu item with nested itens
- How to create a menu with pages and post categories?
- remove specific classes from menu items
- How to add a page to header that is outside of WordPress?
- how to remove description from menu buttons?
- confused about wp_list_pages() function – how to display selected top pages with all their subpages
- How to buid wordpress menu with auto width sub-menu items in dropdown menu without any items sharing one line [closed]
- set certain item in nav walker to active when on archive pages or singles
- wp_nav_menu() | Outputting my own custom code using built in features
- Remove a class from a using Walker
- Add (grand)child pages automatically to nav menu
- how avoid the link of the current post in the menu in the sidebar?
- The cart, checkout, and shop links not getting removed
- Switch an entire nav menu if user is logged in
- wp_bootstrap_navwalker Fatal Error
- WordPress functions.php does not affect the theme menus
- Display Menu Navigation Label
- Menu is not displaying on the site navigation [closed]
- Parent Page > Child Page Menu
- Wp Nav Menu div containers
- Costum walker with sub menu item count
- Page header menu links change
- Catagorized hierarchy menu for PAGES!
- Updated WordPress, now Navigation is Messed Up
- How do I add 3rd level of dropdowns to wp_nav_menu array?
- Possible to append class to nav menu added to widget area?
- Page dependent sub-menu?
- need help in wordpress navbar setup
- adding pages in underscores.me theme
- Can I now add a class in the anchor of my menu item with WordPress 5.4?
- WordPress + Bootstrap: Replace primary navigation menu on mobile?
- Multi-Level Nav Bar
- Add CSS Class to WordPress Menu Item Dependent on the Page the User is Visiting
- Navbar is hidden behind carousel when using wp-boostrap-navwalker
- display cart information within li of cart menu item
- Add data-track to links in menu
- Is it possible to seperate wordpress menu by different div?
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Add newsletter signup element to navigation bar
- Check in walker if current page is descendant
- Page and Posts loading as index page? Not loading the content
- Specific Page that convert Hyperlink to anchor in nav menu
- wp_nav_menu not selecting teh correct menu
- Active page link not getting class assigned
- WordPress – Apperance > Menu
- Highlighting Main Navigation Menu With Two or More Class Matches
- Customize Walker_nav_menu to show posts if item is category
- Menu not always using correct link
- Where these arguments are defined?
- Remove from wp_nav_menu() wordpress
- Show All Children of WordPress Menu
- How to make an anchored page in a navigation menu tab
- Creating an accordion style menu
- How can I structure my pseudo footer nav code with wordpress codex code?
- Two Homes In Navigation Menu
- How to set menu Display location