A Modest Construct

WordPress Post Classes plugin v0.1

This plugin has been superseded by the much-improved Semantic Classes plugin

I’ve written a small WordPress plugin that provides some new template tags that return a post’s tags, categories, author, and date; useful for CSS trickery.

You can view its page here.

This initial release provides the following items:

<?php generate_tag_class(); ?>
This function returns a space-delineated list of the post’s tags, prefixed with ‘tag-’
e.g. tag-politics tag-election-2008
<?php generate_category_class(); ?>
This function returns a space-delinated list of the post’s categories, prefixed with ‘category-’
e.g. category-personal category-random-thoughts
<?php generate_author_class(); ?>
This function returns the author name of a post, prefixed with ‘author-’
e.g. author-Heliologue
<?php generate_date_class(); ?>
This function returns a space-delineated list of the post’s date, prefixed with ‘y’ (year), ‘m’ (month), and ‘d’ (day).
e.g. y2008 m03 d11
« Previous post
Next post »

4 ResponsesLeave one →

  1. Yes, I credit Scott Wallick in the readme. This plugin is inspired by—and reuses some code from—Sandbox/Barthelme. Lot of it is just moving functionality from his functions.php to a separate plugin, so as to be more portable.

    Reply
  2. I didn’t mean to imply any intellectual theft, good sir!

    Reply
  3. I didn’t figure as much. Just wanted to acknowledge that you were right in pointing out the source.

    Reply

Leave a Reply