• Resolved tsjippy

    (@tsjippy)


    I use a filter like this:

    add_filter( 'advanced-sidebar-menu/menus/page/is-displayed', "custom_harmsen_display_children_menu", 10, 4 );
    
    function custom_harmsen_display_children_menu( $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;
    }

    how should I change this for version 8?
    I couldn’t figure out with the migration 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

    (@onpointplugins)

    Hello,

    The plugin classes now use namespaces which match their original name. Basically, you replace Advanced_Sidebar_Menu_ with Advanced_Sidebar_Menu\ for any top level classes, and replace any sub directory names with a \ instead of _.

    In this example, Advanced_Sidebar_Menu_List_Pages is now Advanced_Sidebar_Menu\List_Pages.

    add_filter( 'advanced-sidebar-menu/menus/page/is-displayed', "custom_harmsen_display_children_menu", 10, 4 );
    
    function custom_harmsen_display_children_menu( $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;
    }
    

    Have a great day!

    Thread Starter tsjippy

    (@tsjippy)

    Thank you very much, for this fast reply!
    It works

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Critical error on your website’ is closed to new replies.