• Resolved crom06

    (@crom06)


    Recently, I read Smashing Magazine’s Death of a Blog Post and would like to try to create individualized blog posts. The header and footer would stay the same, but the content – layout and css – is what would change. Can anyone point me on the right track? Or is this something best hand-coded and not run through WordPress?

Viewing 3 replies - 1 through 3 (of 3 total)
  • If you want to change the look of single posts, you could incorporate the body_class() function into your theme using:

    <body id="top" <?php body_class(); ?>>

    You could then style on the individual post id. You’ll find a full list if the possible classes generated by body_class here.

    Thread Starter crom06

    (@crom06)

    Thanks, that explains part of it and I will look at those classes. But what about the layout itself? For example, what if I want 2 columns in one post and 3 columns in another? I think I could do that with a bunch of if elseif statements in single.php, but it would make the file huge over time and I’d like to avoid that.

    It might be better putting your conditionals into header.php – eg:

    <?php if( is_single( array(17, 25, 87, 125) )  ) {?><link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/3-col.css" media="screen" /><?php }
    else (?><link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/2-col.css" media="screen" /><?php }?>
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘change individual post layout and css’ is closed to new replies.