WordPress.org

Ready to get started?Download WordPress

Plugin Directory

BNS Body Classes

Simple plugin that adds classes to the `body_class` output upon activation, including a range of date related classes.

= What are the "Current Date" classes? The "Current Date" classes are a collection of classes dynamically created classes relevant to the date the reader lands on the site. These classes would include on December 1, 2012 at 5:00pm (GMT-5) the following:

  • year-2012
  • leap-year
  • month-12
  • month-dec
  • month-december
  • day-01
  • day-sat
  • day-saturday
  • hour-22
  • hour-10pm

How do I activate the calendar extension?

Included with the package is the file named 'bnsbc-calendar-sample.php'; simply rename this file to 'bnsbc-calendar.php', then edit it to add your own date-specific classes.

As the specifically named file 'bnsbc-calendar.php' is not included with the standard plugin package it should survive any automatic updates via the WordPress Administration Panels. Just in case, it is recommended to keep a backup of your custom calendar in case it is lost from your site for whatever reason.

How do I add a new class in the calendar extension?

After changing the sample file to 'bnsbc-calendar.php' simple find the date you want to add the class to and amend that line.

For example, to add a class for the Ides of March you would edit the March 15 entry and add an appropriate class such as:

  • near line 138: if ( '15' == date( 'd' ) ) { $dates .= ''; } would change to if ( '15' == date( 'd' ) ) { $dates .= ' ides-of-march'; }

NB: Remember to use "safe" characters for class names; and, add a single preceding space to eliminate the risk of classes running together.

Requires: 3.0 or higher
Compatible up to: 3.9.2
Last Updated: 2014-5-3
Downloads: 919

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1 100,1,1 100,1,1
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1 100,1,1
100,1,1
100,1,1 100,1,1 100,1,1 100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1