Support » Plugin: Advanced Sidebar Menu » Hide if no siblings

  • Resolved tsjippy


    I use this plugin, it is fantastic, thanks!

    I have one question though:
    I have a page (A) with just one sub-page (B)

    I want to have the menu on page A showing the link to page B.
    However, when I am on page B the menu is also shown with just the link to page B.
    Can I add something so that the menu is not show if there is just one page and I am currently on that page?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor OnPoint Plugins


    Hi Tsjippy,

    This is possible by adding the following filter your active theme’s functions.php file:

    add_filter( 'advanced-sidebar-menu/menus/page/is-displayed', function ( $display, $a, $i, $current_menu ) {
    	$child_pages = Advanced_Sidebar_Menu_List_Pages::factory( $current_menu )->get_child_pages( $current_menu->get_top_parent_id(), true );
    	if ( count( $child_pages ) === 1 ) {
    		$current_page = $current_menu->get_current_post();
    		if ( null !== $current_page && reset( $child_pages )->ID === $current_page->ID ) {
    			return false;
    	return $display;
    }, 10, 4 );

    Have a great day!

    Thread Starter tsjippy


    works, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hide if no siblings’ is closed to new replies.