Widget contexts let you control when WordPress widgets display on your site.
|One of the widgets added in this example is an ad for Semiologic.|
|When the Edit link on the widget bar is clicked the widget opens so that the content can be Edited as required and the Contexts selected.In this case there is a page on this blog which is a review of Semiologic together with a banner ad and affiliate links similar to that contained in the Ad widget.
The duplication of another ad in the sidebar is not appropriate and the ‘Semiologic & Wordpress’ Section context is checked off.
Note that Parent level pages are called Sections.
Using contexts it is possible to precisely select which widgets are displayed on which posts and pages.
Available Widget Contexts
This context applies to your site’s front page.
Depending on your setup, this will be the blog’s main page or a static front page. In the latter case, it will override any template-specific context.
Blog on a Static Page
This context applies to your blog’s front page, in the event that you’ve set up a static front page. Ignore it if you haven’t.
This context applies to individual posts.
This context lets you set the defaults for newly created sections.
Section / Name
This context applies to that static page, and to all of its children.
Template / Name
This context applies to static pages that use that template, and overrides the section-specific context.
Note that the Sales Letter template in the Semiologic theme features no header, no footer, and no sidebars. For this reason, the context isn’t available in these areas.
This context applies to attachment pages, which are created by WordPress when you use the media uploader.
This context applies to category pages.
This context applies to tag pages.
This context applies to other archives pages.
This context applies to search result listings on your site.
This context applies to 404 Error: Not Found pages.
Widget Contexts Best Practices
Here’s how I’m using the feature on this site:
Each section has branch pages (Resources, Resources / Widgets) that use the “Special Page” template from the Semiologic theme.
These are stub pages who are only present for the sake of organizing the site. Their content is, for the most part, automatically generated using Silo Stubs.
I didn’t see much point in configuring these stub pages differently from a section to the next, so I felt happy to control them all using a single context: Template / Special Page.
Their leaf pages (Resources / Widgets / Widget Contexts ) use the default template, and thus their section’s context.
This allows me to put toggle widgets on and off depending on the sections.
Other Special Pages
A few other branch pages (Archives) use the default template, and thus their section’s context.
While we’re on the topic of archives pages, note that by combining widget contexts and inline widgets, you probably won’t ever need to use an Archives template or a Links template.
The Archives template can nonetheless come in handy if you organize your site as follows:
/(a static front page)
/blog/(a static page for your blog)
/blog/archives/(a custom-designed archives page)
The Links template becomes useful if you want to spread links pages all over the place, and still have them look all alike from a section to the next. (Much like I do with my above-mentioned section stubs.)
Frequently Asked Questions
Some widget contexts don’t work!
If you’re using the Semiologic SEO plugin, your preferences (Settings / SEO) may be so that these contexts, all in the Each Entry panel, are ignored:
That is because you’ve configured Semiologic SEO to assist you in fighting duplicate content on your site.
I Need More Static Pages Contexts
You can add new ones by creating new static page template files.
Assuming you’re using the Semiologic theme, drop a copy of the special.php file in the theme’s folder. Open it in a text editor such as notepad, change the template name, and you’re done.
I’d Like a Context For This Specific Category
The short answer is you cannot, and this won’t be available any time soon.
Plus, you probably shouldn’t be using posts for what you’re seeking to achieve.