WordPress plugin intelligence profile

Ambrosite Body Class Enhanced

Enhances the body_class template tag, adding some extra classes to the body (post/page slugs, post categories, and archive parent categories) useful i …

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 3.2
Current version1.3
WordPress coverageTested up to WordPress 3.2
Minimum stackWP 2.8 · PHP —
Directory statusactive
Last directory update3 Jul 201115y ago
Active installations200Adoption metric — not a quality score
WordPress.org rating5.0 / 5 from 5 ratings
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Ambrosite Body Class Enhanced version 1.3 as active, updated 15y ago and tested up to WordPress 3.2.

Overview

About this plugin

When activated, this plugin causes the body_class template tag to output five additional classes.

On single posts (is_single):

postname-[permalink slug]

single-[category slug]

parent-[parent category slug] (all parent and grandparent categories in a hierarchy of any depth)

On pages (is_page):

pagename-[permalink slug]

On category archives (is_archive and is_category):

parent-category-[parent category slug] (all parent and grandparent categories in a hierarchy of any depth)

Custom Taxonomies

3, the plugin now supports custom hierarchical taxonomies. The new body classes take the following form:

On single posts (is_single):

single-[taxonomy]-[term slug]

parent-[taxonomy]-[parent term slug] (all parent and grandparent terms in a hierarchy of any depth)

On taxonomy archives (is_archive and is_tax):

parent-term-[parent term slug] (all parent and grandparent terms in a hierarchy of any depth)

For single posts, the taxonomy name is included in the class name, because I felt it was important to be able to distinguish between taxonomies in cases where a post is assigned to more than one custom taxonomy, and when the same term might appear in two or more taxonomies. For example, suppose you had a real estate site with property listings in New York City, and you had two custom taxonomies defined: City and State. Then the classes would look like this:

single-city-new-york single-state-new-york

Multisite Support

3, the plugin now supports multisite installations. If a multisite install is detected, the plugin will output the follow additional body class on every page of the site:

site-[site ID]

Examples

If you have a post titled “Top 10 Decorating Ideas”, in category “Christmas”, with a parent category of “Holidays” and a grandparent category of “Calendar”, the additional body classes will be as follows:

postname-top-10-decorating-ideas single-christmas parent-holidays parent-calendar

Why is this useful? Because it enables you to style individual posts and pages, as well as entire categories of posts, using only CSS, without having to edit the template files or create new templates.

Continuing the above example, if I wanted to give all of the posts in the Christmas category a green heading (to give them some extra holiday cheer), I could use a CSS selector like this:

single-christmas h1 { color: green; }

Going further, suppose I want to attach a background image of a Christmas tree ONLY to the “Top 10 Decorating Ideas” post:

gif') no-repeat left top; }

What if I want all posts categorized under Holidays (Christmas, Thanksgiving, Easter, whatever) to have a sidebar with a gold border?

single-holidays div#sidebar { /* any posts assigned directly to the Holidays category */ border: solid 2px gold; }

These are just a few examples. If you are experienced in writing CSS selectors, you will find many more uses for the new body classes. org/support/topic/393942

WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • body class
  • classes
  • page
  • post
Compatibility & maintenance

Compatibility & maintenance

Tested up to WordPress 3.2

Not yet marked as tested with WordPress 7.1. WordPress.org currently lists Tested up to 3.2.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to3.2
Minimum requirementsWordPress 2.8 · PHP not listed
Update activity3 Jul 201115y ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.