WordPress plugin: Apply a CSS class defined in a post’s custom field
It's not much, but it's helped the look of my site. By applying a custom field to a specific blog post like so:

Your content (regardless of index, archive, or single placement) then renders like so:
<div class="MyCssClass">Actual Blog Post Here</div>
This allows each post to have different (but common) CSS Styles. Other plugins allow you to apply a custom stylesheet per-post, but my plugin is more useful when there are a few common styles you want to re-used. All that's missing is uploading the following code to your wp-content/plugins directory:
<?php
/**
Plugin Name: Legion's Div Content Plugin
Version: 0.1
Description: Wraps the the_content with a custom css class specified in the "legioncss" custom field
Author: legion
Author URI: http://FeelingsOfWhite.com
*/
add_filter('the_content', 'legiondiv_the_content');
function legiondiv_the_content($content) {
global $post; //required to access $post->ID
$customCssClass = get_post_meta($post->ID, "legioncss", true);
if ($customCssClass != "")
$content = '<div class="' . $customCssClass . '">' . "$content</div>";
return $content;
}
?>
As a n00b to WordPress, it's hackability has impressed me. I'm amazed that this is all it takes to write a plugin. There are plenty of fantastic resources available just by searching the web.
Fun. Add to your bookmarks. And how long it took to write articles?
Hi Bush, good to meet you. I'm glad you liked the article enough to bookmark it :)
The time it takes to write an article varies. This one didn't take that long, maybe an hour or two (although developing the plugin took an evening of learning). Other articles, like my recent Tamdhu stories or my .net programming article took many many hours over a period of months.
I hope you keep coming back, Bush :)
I am stoked to meet new people here. It looks like a
fantastic place!
I'm into playing fishing.
Any others here?