If I understand your question right, here is the code to show the list of page siblings (having the same parent). Call the function from the sidebar.
<?php
function show_page_siblings( $id ) {
$parent_id = wp_get_post_parent_id( $id );
// show only on child pages
if( 0 == $parent_id ) {
return;
}
$siblings = get_pages( array(
'child_of' => $parent_id,
'hierarchical' => 0,
'parent' => $parent_id,
'post_type' => 'page',
'post_status' => 'publish'
));
if( !empty( $siblings ) ) {
echo '<ul>';
foreach( $siblings as $sibling ) {
echo '<li><a href="' . get_permalink( $sibling->ID ) . '">' . $sibling->post_title . '</a></li>';
}
echo '</ul>';
}
}
Related Posts:
- List children of second level sub page
- Add sidebars to navigation menu?
- Different side menu on each page
- Sub-Pages only of menu items in current branch using a custom menu
- Change HTML structure for custom menu in sidebar
- Vertical Sidebar Menu Parent and Child not displaying correctly [closed]
- display menus on all page except one?
- How to show dynamic side bar on menu item [closed]
- Displaying different page links on different pages
- Dynamic_sidebar inside wp_nav_menu
- Submenu in sidebar custom page template
- Simple form to add custom links to menu?
- How to create menu spread over four lines including images
- Adding widget to sidebar which contains current page’s submenu
- Dynamically exclude menu items from wp_nav_menu
- wp_nav_menu: show menu only if one exists, otherwise show nothing
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Making breadcrumb with wp_nav_menu
- adding some custom html code to the wp_nav_menu function
- Renaming a WordPress Admin Menu
- How to add active class on current menu item page?
- How do you get the current-menu-item ID?
- How do I give class to the dropdown sub-menu in the wp_nav_menu?
- rename navigation menu label in wordpress theme by code
- menu entries are lost
- Nav Menu and display post count
- Automatically Add New Tags to Sub-menu
- how to automatically generate hierarchical menus from hierarchy of pages?
- Adding a ‘mega menu’ to my site without a plugin
- Error “The given object ID is not that of a menu item” on menu with 40+ items
- TwentyTwelve child theme mobile menu not working
- Adding post excerpt into navigation menu
- Editing WordPress Nav Menu Walker
- Convert WP Menu to a Drop Down for Mobile browser
- WordPress Admin Bar Covering & Overlapping Fixed Menu Header [closed]
- I am facing a problem with the navigation menu of my website
- Prepend to start of WordPress nav loop
- Change search results order for Admin -> Appearance -> Menus -> Pages -> View all
- Add custom external link to menu
- Child page menu in sidebar
- Check if menu_item has children or has parent
- wp_nav_menu add class to child item with sub child
- How to remove menu installed in wp-admin by a theme? [closed]
- Why is wordpress forcing https link generation?
- Container class not appearing on navigation menu
- pull non-wp site into content area of wordpress -or- pull wp header into non wp site?
- cross-site custom menu
- How to remove the HOME menu item
- WordPress template – How to add class to li tag if submenu exist
- How to get rid of the home link in nav menu?
- display menu as table layout
- How to change the location of the menu
- Bootstrap button menu on wordpress
- Want to add different text after each menu item
- How to create a menu item which is not a page
- How can I make a menu link visible only to admins (without plugins)?
- How to list only root pages?
- Page menu with one image link instead of page title?
- Is there a way to tell menu items to force non-SSL URLs?
- Search if menu item has child in wp_get_nav_menu_items hook
- Trouble hiding menu on single page
- change hover color of specific menu link [closed]
- How can I make a WordPress sub-menu with a top-level that isn’t clickable?
- How to customize navigation menu in theme which is converted from pure html theme
- enqueue script during add menu items means before save menu items
- WordPress classes removed when using custom walker
- Custom HTML output for registered navigation
- Show subpages of a category in a custom menu
- How to add a menu that belongs to parent blog to all child-blogs?
- How to create this kind of sub-menu in new line?
- How to use wp_list_pages on a grandparent page
- Dropdown primary navigation menu not working
- Understanding with this WordPress code
- How do I make it so a post only shows in its category archive but not the home page?
- Link after WordPress
- Im having trouble centering menu items in footer due to “flexbox”
- When created sub-directory, can we create a new navbar?
- Is it all right to put the whole tag into template_part file?
- Mobile menu displays submenus on top of parent. Need it to display right below on an own line
- Misleading behaviour on Menu & Theme location
- How to build a menu that change style over a section
- Menu flickering with each refresh on Google Chrome [closed]
- Remove Double Menu in Mobile View and Have one Menu Only
- How i can get current menu id with multiple occurrence
- How to get rid of the bottom line in the navigation menu via CSS file?
- Links in new menu don’t work
- Vertical Menu items shifting to same line when window size increased [closed]
- Installing compact search in the main menu?
- Next/previous a-like single navigation
- How to create a menu super voice in WP?
- Showing Custom Menus in the sidebar
- How to set up suhosin.ini for unlimited menus
- Somehow lost my MENU from my home page- help!
- How to completely remove the top section with the menu?
- Customizing Responsive Themes Menu [closed]
- How To Conditionally Change Menu In Same Theme Location
- Add menu to CMS page
- Not even able to Log in [closed]
- how can i get the page_ID in nav li [closed]
- How to replicate a mobile menu from a site to a wordpress site [closed]