Plugin Author
wizzud
(@wizzud)
I’m sorry but No, not using the options.
The closest decision-making option CMW provides is the ability to switch options based on the presence/absence of a Current Item, and even then you can’t switch from one menu to another.
CMW does have a filter that might be used, if you could decide on the actual test that needed to be made…
add_filter( 'custom_menu_wizard_settings_pre_widget', 'your_filter_function', 10, 2 );
function your_filter_function( $instance_settings, $widget_id_base ){
//$instance_settings are the sanitized options for this CMW instance
if( [your_test_criteria] ){
//prevent this CMW instance outputting anything...
$instance_settings = array();
}
return $instance_settings;
}
…which could prevent/allow the running of any CMW instance. You’d need two separate instances of CMW – one based on Menu 1, the other based on Menu 2 – and your test criteria would have to include inspection of the widget settings to see which instance you’re filtering at the time, as well as somehow reliably determining which page you’ve come from. (Bear in mind that the filter gets called once, separately, for each instance of CMW, and that it runs before any of WordPress’s nav menu functions get called).
If you’re comfortable with PHP then you could add such a filter to your theme’s functions.php (preferably a child theme!).
Dear Wizzud
Thanks for your prompt reply.
Perhaps I have another idea. Is there a decision-making option based on the exact URL of the Current Item (Post)?
In my example the post “How to Sew” is accessible via 2 URLs. In Custom Menu 1 and 2, I could pinpoint to this relevant URL:
Menu 1 “Learn to Sew”
Contains Menu Item with URL: /learn-sew/how-to-sew
Menu 2 “Learn to Fix Stuff” containing
Contains Menu Item with URL: /learn-fix-stuff/how-to-sew
Plugin Author
wizzud
(@wizzud)
Only by using the filter, with multiple CMW instances.
CMW isn’t a “which menu to show…?” plugin, it’s a “what to show from a specific menu…?” plugin.