Custom Classes: WordPress Plugin
For a recent project, I needed a way to add custom post and body classes on a per-post basis. Sure, I could have used a category or tag to style each post, but I hate creating custom categories and tags for the purposes of styling a post. So, I created a small plugin to let me add custom classes for individual posts.
How the plugin works
The plugin adds a custom meta box on the edit post screen for any public post type called “Classes” as shown in the following screenshot.
The meta box allows you to enter a custom class for a post (used by the
post_class() function) or a custom body class (used by the
The following screenshot shows what your
<body> class will look like in the source code on a single post.
All you have to do is style your posts via CSS using the custom classes you’ve addded.
Download the plugin
You can download the latest version from the WordPress plugin repository: Custom Classes Plugin. I hope you enjoy it and find some use for it in your projects.
Please do not ask support questions in the comments below. If you're in need of plugin support, head over to the Theme Hybrid support forums, which is where I handle support for all my plugins and themes.