Context Manager makes your site behave differently depending on the current user’s context. Using the simple point-and-click admin pages, there are four different ways your site can react:
- Changing the behaviour of menu items
- Hiding widgets in sidebars
- Adding extra classes to the
The plugin supersedes Menu Rules
A website has e-commerce shopping functionality driven by a custom post type called ‚products‘. There’s an archive page called ‚shop‘ that lists products and is linked to in the main navigation menu.
A user visits ‚shop‘ and the menu item becomes ‚active‘, but when they click through to an individual product, the menu item loses its state. The user becomes lost.
- Install the Context Manager plugin
- Add a new context 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
On the product page, there are irrelevant widgets that distract the user from making a purchase.
- Hide irrelevant widgets under the widgets reaction
The whole shop section requires its own colour scheme, but there’s no common class that ties all the pages together.
shop-sectionclass name in the body class reaction. Or alternatively, register another stylesheet using
wp_register_style()in you theme’s
Remember to click publish when you’re ready to save.
Have a look at screenshots to see the above setup in action.
If you’re stuck, ask me for help on Twitter.
- Download and unzip the folder from the WordPress plugins repository
- Upload the context-manager folder into to the
- Activate the plugin through the ‚Plugins‘ menu in WordPress
- Open the ‚Appearance‘ menu item and click the ‚Context Rules‘ link
Pro tento plugin nejsou žádné recenze.
Context Manager je otevřený software. Následující lidé přispěli k vývoji tohoto pluginu.Spolupracovníci
- [Bugfix]: disabled assets reaction which triggered errors in 3.6. No feasible workaround found yet
- [Bugfix]: added conditional checks into widgets reaction
- [Bugfix]: menu_reaction property not being set in child page and inactive parent menu reactions
- [Bugfix]: Some environments were triggering a fatal error related to html() due to an action being added to a hook too late
- [Bugfix]: Asset reaction generating a global site error if not logged in
- [Bugfix]: Major issue that generated an error when adding or editing a context rule
- [Bugfix]: Errors in widget reaction when site has orphaned widgets
- [Added]: Assets reaction
- [Bugfix]: get_rules() using incorrect meta_query parameter
- [Bugfix]: PHP 5.4 fatal errors
- [Bugfix]: Body class and widget reactions caused an error when no rules were set up
- [Bugfix]: Invalid foreach warning when no rules were added in get_rules()