Show Full Menu Always Resolved Requested: 1 year and 2 months ago I’m hoping to show the full menu always. Right now I have about 12 top-level pages. There is no singular parent for the entire menu. Is it possible to override something in the PHP to always show the full menu?
OnPoint Plugins 1 year and 2 months ago Hi Jon, This may be accomplished using a template override. Create a new directory in your active theme named advanced-sidebar-menu. Create a new file in the new directory named page_list.php. Enter the following contents in the new file. <?php use Advanced_Sidebar_Menu\List_Pages; use Advanced_Sidebar_Menu\Menus\Page; $menu = Page::get_current(); $list_pages = List_Pages::factory( $menu ); $child_pages = $list_pages->get_child_pages( $menu->get_top_parent_id(), true ); $content = ''; $widget_args = $menu->get_widget_args(); $menu->title(); $content .= '<style>#' . $widget_args['widget_id'] . ' .parent-sidebar-menu{margin-bottom:0 !important;}</style>'; $ids = get_posts( [ 'post_type' => $menu->get_post_type(), 'numberposts' => 100, 'fields' => 'ids', 'orderby' => $menu->get_order_by(), 'order' => $menu->get_order(), 'post_parent' => 0, 'post__not_in' => $menu->get_excluded_ids(), ] ); $parent_args = $list_pages->get_args( Page::LEVEL_PARENT ); $list_args = $list_pages->get_args( Page::LEVEL_DISPLAY_ALL ); foreach ( $ids as $_page_id ) { $content .= '<ul class="parent-sidebar-menu" >'; $parent_args['include'] = $_page_id; $content .= wp_list_pages( $parent_args ); $child_pages = $list_pages->get_child_pages( $_page_id, true ); if ( ! empty( $child_pages ) ) { $content .= '<ul class="child-sidebar-menu">'; $list_args['child_of'] = $_page_id; $content .= wp_list_pages( $list_args ); $content .= '</ul><!-- End .child-sidebar-menu -->'; } $content .= '</li></ul><!-- End .parent-sidebar-menu -->'; } return $content; Have a great night!
Hi Jon,
This may be accomplished using a template override.
advanced-sidebar-menu
.page_list.php
.Have a great night!