- This topic has 16 replies, 3 voices, and was last updated 7 years ago by Tom.
-
AuthorPosts
-
March 6, 2017 at 1:31 pm #287901Les
I did several forum searches but couldn’t find a solution.
I’m looking to do sub-navigation in the left sidebar. I would like only the current website section (not to be confused with GP Sections) and it’s children to appear in the sub menu.
Is this possible without having to create a separate, stand-alone menu for each section? I would like it if it just used the global menu so that my client just has to maintain one menu.
Here’s the site I’m working with:
http://www.vwnaus.com/themeone/sub-navigation/Thank you in advance!
March 6, 2017 at 4:46 pm #287976LeoStaffCustomer SupportHi Les,
So basically you want a different sidebar menu for each page?
If so maybe try these two plugins?
https://wordpress.org/plugins/page-specific-menu-items/
https://wordpress.org/plugins/menu-swapper/It might help if you can provide an example of what you are after.
March 6, 2017 at 6:35 pm #288011LesHere’s an example of a website that has the side-navigation like I’m referring to.
http://www.bayoupreservation.org/About/Stewards-of-Our-Bayous
I want to avoid using something like menu-swapper because with that, you have to create multiple menus.
Thank you!
March 6, 2017 at 6:48 pm #288015LeoStaffCustomer SupportHmm then you can try using CSS and target each page and menu item. So something like this:
.page-id-## .inside-right-sidebar .menu-item-## { display: none; }
It will be a bit of work to go through each page but you should be able to keep it to one menu.
March 6, 2017 at 7:08 pm #288018LesThank you for the feedback Leo. I was hoping there was something that would be a little more automated. Like to where it would programmatically know what section of the site was the current one; and hide the others.
Kind of like how WP is able to set the current page class on the li in the menu so you can have the current page/section be a different color. e.g. li.current-menu-parent
Thanks again!
March 6, 2017 at 7:41 pm #288032LesThis plug-in does (did!) what I want, but it’s very old > https://wordpress.org/plugins/simple-section-navigation/screenshots/
March 6, 2017 at 7:42 pm #288033LeoStaffCustomer SupportYou got me thinking and I’m close to getting it to work with CSS…I think…
March 6, 2017 at 8:13 pm #288044LesThank you again Leo! I look forward to seeing what you come up with.
Also, I stumbled across this which may be another option:
https://wordpress.org/plugins/bu-navigation/faq/
http://developer.bu.edu/bu-navigation/
https://github.com/bu-ist/bu-navigation/wiki/Content-Navigation-WidgetMarch 6, 2017 at 10:07 pm #288077LesAll told Leo, I love the idea of a simple CSS solution. Looking forward to what you find out!
March 7, 2017 at 7:49 am #288298LesAny updates on the CSS solution? Thank you!
March 7, 2017 at 8:05 am #288316TomLead DeveloperLead DeveloperI’m not sure this is possible with CSS, unless Leo has thought of something?
I did find these though:
https://en-ca.wordpress.org/plugins/be-subpages-widget/
https://en-ca.wordpress.org/plugins/flexi-pages-widget/
http://www.wpbeginner.com/wp-tutorials/how-to-display-a-list-of-child-pages-for-a-parent-page-in-wordpress/March 7, 2017 at 12:30 pm #288435LeoStaffCustomer SupportIf Tom doesn’t think it’s possible with CSS then it’s definitely not possible. sorry to get your hopes up! Looks like a plugin would have to do.
March 7, 2017 at 12:36 pm #288437LesThank you Tom!
I’d like to avoid another plug-in, so I’m trying the WP Tutorial you linked.
Added this to my child-theme functions.php:
//sub-page display from -> http://www.wpbeginner.com/wp-tutorials/how-to-display-a-list-of-child-pages-for-a-parent-page-in-wordpress/
function wpb_list_child_pages() {
global $post;
if ( is_page() && $post->post_parent )
$childpages = wp_list_pages( ‘sort_column=menu_order&title_li=&child_of=’ . $post->post_parent . ‘&echo=0’ );
else
$childpages = wp_list_pages( ‘sort_column=menu_order&title_li=&child_of=’ . $post->ID . ‘&echo=0’ );
if ( $childpages ) {
$string = ‘- ‘ . $childpages . ‘
‘;
}
return $string;
}
add_shortcode(‘wpb_childpages’, ‘wpb_list_child_pages’);I attempted to create a new page template by duplicating the GP page.php file and adding it to my child theme directory… but since this is related to the sidebar, I think that I’ll need to hunt for a different tutorial.
I also tried to add the shortcode [wpb_childpages] to my left sidebar widget, but nothing displays on the front-end.
http://www.vwnaus.com/themeone/sub-navigation/
Thank you again for the assist!
March 7, 2017 at 4:40 pm #288539LeoStaffCustomer SupportLooks like you got it working>? I see the submenu in the sidebar now.
March 7, 2017 at 5:19 pm #288565TomLead DeveloperLead DeveloperUsing [wpb_childpages] in your text widget would be the way to go for sure 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.