Context Manager does the same job as Menu Rules, but comes with many more features to save you time and unnecessary coding.
Menu Rules can run alongside Context Manager while you migrate your rules across. Speak to me on Twitter if you need any help with the transfer.
About Menu Rules
In WordPress there’s no way to apply context to the menu system. Menu Rules solves this problem and gives you a framework to write your own menu extensions.
You have an e-commerce website that has a custom post type called ‘products’. You have a page that lists products which is listed in your main menu. A user visits the page and the menu item becomes ‘active’. You click through to a product and the menu item loses its active state. This is how to fix it with menu rules:
- Install the Menu Rules plugin
- Add a menu rule
- Give it a meaningful name in the title field. This is just for administration purposes
- In the conditions field enter
is_singular( 'product' )
- Choose Emulate current page as a child but do not create a menu item. as the menu rule
- Find your products page in the menu dropdown
- Hit publish
Extending Menu Rules
- Create a class that extends
Menu_Rules_Handlerand includes a
- Write your custom functionality
- Register your class using
add_action( 'plugins_loaded', create_function( '', 'Menu_Rules::register( "Your_Menu_Rule_Class" );' ) );
Built-in rules are found in
If you’re stuck, ask me for help on Twitter.
- Download and unzip the folder from the WordPress plugins repository
- Upload the menu-rules folder into to the
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Open the ‘Appearance’ menu item and click the ‘Menu Rules’ link
- Add a new menu rule and click ok.
There are no reviews for this plugin.
བྱས་རྗེས་འཇོག་མཁན། & གསར་འབྱེད་པ།
“Menu Rules” is open source software. The following people have contributed to this plugin.བྱས་རྗེས་འཇོག་མཁན།
Interested in development?
- Upgrade notice to Context Manager
- Fixed fatal bug in PHP 5.4
- Conditions and Reactions divided into 2 meta boxes to improve usability
- Theme improvements
- Added description and footer options to PB Framework forms
- Moved plugin meta box styles into PB Framework
- Added default meta box display in PB Framework
- Added field setter for PB Framework meta box class
- Bugfix where frontend assets weren’t being loaded when on a new menu rule
- Bugfix in meta box get_fields()
- Bugfix for post updated messages
- Added new force inactive parent rule
- Changed behaviour to one rule per item
- Minor enhancements to PB Framework
- Cleaned some unused code