Support » Plugin: Ocean Extra » Ocean Extra interferes with Plugin WP Nav Plus

Viewing 4 replies - 1 through 4 (of 4 total)
  • note: Author of WP Nav Plus here, this post triggered an email alert for me and I made it a good way through responding before I noticed this isn’t even on my own support forum. I’ve decided to leave my response below:

    WP Nav Plus is only configured to override/set the fallback function if it isn’t already set, or it is set with the default wordpress fallback “wp_page_menu”.

    In this case it looks like it is set with the Oceans theme OE_Menu_Icons_Front_End::_fallback_cb function. So my plugin takes a hands off approach and assumes that ‘whoever’ is setting this fallback has a good reason to do so.

    I agree that editing a plugin to fix a problem is pretty much never the right way to go. Two ideas:

    1) The author of the oceans extra plugin could make a filter to enable/disable the fallback.
    2) You could use the “wp_nav_menu_args” filter on your own in your functions.php file, but with a higher priority than the filter used in either of the plugins in question (they use the default priority of 10). Your function with a higher priority would have the final say on what this fallback is set to. Untested example below:

    function my_nav_args( $args ) {
    	// Probably will want to check something in $args to make sure you are targeting only the menu in question here, and return early if we are not looking at the right menu
    	// if ( something != $args['something'] ) { return $args; }
    
    	$args['fallback_cb'] = 'WP_Nav_Plus_Start_Depth::fallback';
    
    	return $args;
    }
    add_filter( 'wp_nav_menu_args', 'my_nav_args', 20, 1 );

    Hope this helps.

    Yes, it was helpful. And it works with the following lines in functions.php

    [code]
    function my_nav_args( $args ) {

    if ( "Mein Menu" == $args['menu']->name ) {
    $args['fallback_cb'] = 'WP_Nav_Plus_Start_Depth::fallback';
    }

    return $args;
    }
    add_filter( 'wp_nav_menu_args', 'my_nav_args', 20, 1 );
    [/code]

    Many thanks for your quick response!
    Resolved for me.

    Plugin Author Amit Singh

    (@apprimit)

    @mattkeys thank you for the detailed information. It will definitely help others if they have a similar issue.

    … eeehm, minor correction on second line of code

    function my_nav_args( $args ) {
    
    	if ( 'Mein Menu' == $args['menu'] ) {
    		$args['fallback_cb'] = 'WP_Nav_Plus_Start_Depth::fallback';
    	}
    
    	return $args;
    }
    
    add_filter( 'wp_nav_menu_args', 'my_nav_args', 20, 1 );
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.