[resolved] Possible to use different stylesheet for comments than main blog? (5 posts)

  1. Sphagnum
    Posted 10 years ago #

    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: http://www.snook.ca/archives/000368.php

    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)

  2. Kafkaesqui

    Posted 10 years ago #

    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; ?>

  3. Sphagnum
    Posted 10 years ago #

    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!)

  4. Kafkaesqui

    Posted 10 years ago #

    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)) :

  5. Sphagnum
    Posted 10 years ago #

    Changed, thanks so much

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.