Q:

adding a custom css class to post

essentially I need to be able to add a class to a post when it show in the list (say index.php) so when in the back end you can say oneCol, twoCol, threeCol and it will then output this within the loop post class.
This is to enable a tighter control of the layout. using this line of code for the output?
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>

Thanks in advance!

A:

Note -
I recommend using the hook suggested by @Chip Bennett in another answer
Here's the modified version of that filter - 
function wpse_filter_post_class( $classes ) {
    $my_post_class = get_post_meta($post->ID, "your_meta_name");

    if( $my_post_class != '' )
      $classes[] = $my_post_class;

    return $classes;
}
add_filter( 'post_class', 'wpse_filter_post_class' );

You can setup a Custom fileds for that - See usage, then use get_post_meta() function to fetch it and show where you want
Example -
<?php echo get_post_meta($post->ID, "your_meta_name", true)?>

This will output the class name set in the meta_key. 
OR ( Update #1 ) -
Pass the variable into Post Class
<?php $my_class = get_post_meta($post->ID, "your_meta_name") ?>
<div id="post-<?php the_ID(); ?>" <?php post_class( $my_class ); ?>>

