Context Manager

plugin banner

Make your site react to users' context by changing your theme's CSS and JavaScript files, navigation menus, sidebars and the HTML body tag.

Author:Phill Brown (profile at wordpress.org)
WordPress version required:3.2
WordPress version tested:3.7.36
Plugin version:1.2.0
Added to WordPress repository:15-12-2012
Last updated:13-11-2013
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:100
Rated by:5
Plugin URI:
Total downloads:4 028
Active installs:50+
plugin download
Click to start download

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:

  1. Include and exclude CSS and JavaScript files
  2. Changing the behaviour of menu items
  3. Hiding widgets in sidebars
  4. Adding extra classes to the <body> tag.

The plugin supersedes Menu Rules

Example usage

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.

  1. Install the Context Manager plugin
  2. Add a new context rule
  3. Give it a meaningful name in the title field. This is just for administration purposes
  4. In the conditions field enter is_singular( 'product' )
  5. Choose Emulate current page as a child but do not create a menu item. as the menu rule
  6. 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.

  • Enter shop-section class name in the body class reaction. Or alternatively, register another stylesheet using wp_register_style() in you theme’s functions.php.
  • Create

Remember to click publish when you’re ready to save.

Have a look at screenshots to see the above setup in action.

Support

If you’re stuck, ask me for help on Twitter.


Screenshots
ChangeLog