Site logo

Archived topic

Collapsible sidebar menu

3 replies · Started by Paul on May 10, 2021

Viewing posts 1–4 of 4

How can I replicate the way the menus work on this website?

https://www.cardiomyopathy.org/cardiomyopathy-information/cardiomyopathy-information

On the home page, no sidebar menu is shown, but when selecting a top menu item, the sidebar shows the options for the menu, highlighting the current page.

This is my website...

https://www.suddencardiacarrestuk.org/

I've tried the standard menu widget in the sidebar and https://wordpress.org/plugins/advanced-sidebar-menu/ but not managed to get it as I want.

Any help would be appreciated

Hi there,

the example site you provided is using page hierarchy ie, Parent pages and Child Pages.

So for example, all sub menu pages in your primary navigation need to be a chid of its parent.
e.g

Parent: Information
Child 1: Cardiac Arrest
Child 2: Practical Issues
Child 3: Sequelae

Likewise each Child would also be a parent....

The sidebar menu plugin requires this kinda setup. And it also means that WP will output the necessary hierarchical classes for each menu item and if you add a breadcrumb it will show the correct trail.

OK thanks.

I'm in the process of moving the pages to a hierarchy, rather than the flat structure I have,

I have done it on a section of my menu and it looks better

https://www.suddencardiacarrestuk.org/information/sequelae/

I've also moved the sidebar menu to the left.

I have my breadcrumb ([wpseo_breadcrumb]) in the generate_after_header hook but it comes out too far to the left.

I want it aligned with the sidebar, how can I do that?

Replace your breadcrumb code in the hook with this:


<?php
if ( function_exists('yoast_breadcrumb') ) {
    yoast_breadcrumb( '<div class="grid-container grid-parent"><p id="breadcrumbs">','</p></div>' );
}
?>

If you were using the shortcode before then make sure to check Execute PHP and disable Execute shortcodes.

This archived topic is closed to new replies.