Support » Themes and Templates » Possible to use different stylesheet for comments than main blog?

  • Resolved Sphagnum


    Question: Is there a way to reference one stylesheet when viewing my main page and reference a seperate stylesheet when viewing an individual post (with comments open)?

    This is my blog now:

    What I am toying around with is creating a comment form similar to this page:

    where the comment form stays in between the two columns. So I’d just split apart my two column theme to get a similar effect. My quesiton is this. I really don’t want to have a large empty column when my main page is viewed… I only want the big gap there to be filled when someone is viewing an individual post (and therefore able to comment)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Here’s a mod of what I do on my site (this resides in my theme’s header.php):

    <?php if(is_single()) : ?>
    <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('stylesheet_directory'); ?>/style-single.css" />
    <?php else : ?>
    <link rel="stylesheet" type="text/css" media="screen" href="<?php bloginfo('stylesheet_url'); ?>" />
    <?php endif; ?>

    Hm, that is exactly what I’m looking for. Didn’t konw that function exsisted ,is_single()… After finding out that the function returns TRUE if you’re viewing a single post, I know exactly how to use it. Thanks!

    (The long answer is to help anyone else who might run across this thread, thanks!)

    I just noticed your requirement for having comments open. If you wanted to limit to just those posts, replace the first line in the code above (is_single()) with the following:

    global $wp_query;
    $post = $wp_query->post;
    if(is_single() && ('open' == $post->comment_status)) :



    Changed, thanks so much

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Possible to use different stylesheet for comments than main blog?’ is closed to new replies.