Support » Themes and Templates » plse help troubleshoot css for specific page issue

  • Resolved arjay1


    I am using Weaver theme in WP 3.5.1. I am trying to convert a previously hand-coded site of mine into WP format. All but one page will be static with the exception being a blog page. I need the width of posts on the blog page to be different to the content width of the other pages (middle column with sidebars left and right).

    I have googled and read until my screen went blurry and read maybe 50 posts. I settled on making a change to the header.php file of the theme to call one css for the blog page and another for all the other pages. This is the code I tried:

    <?php if ( is_page('406') ) {
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>"/>
    <?php } else { ?>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" />
    <?php } ?>

    This doesn’t seem to make any difference – the blog css file should set the #content margins/width to different values than the main css as it contains:

    margin-left:250px !important;
    width:450px !important;

    I know the header.php file is the correct one because if i rename it the pages display badly wrong. I have also tried creating a custom field for the exception blog but not sure how to call this. I have also tried the Specific CSS or Java plugin where I have added the changed #content values and also tried to call the relevant css file with that plugin – no joy.

    The WP site is a right mess at the moment with all pages at different stages of development but I can provide a link if really necessary.

    Can anyone help me progress this? Tnx

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael


    Forum Moderator

    the ‘posts page’ (or blog page, if it is set as the ‘posts page’ under settings – reading) is checked with the conditional tag is_home()

    Ah – thanks for your prompt reply and the link. A bit brief, your reply, but I guess the longer you moderate the shorter the replies become. You must get tired of repeating yourself! But hopefully I’ll figure it out with what you’ve provided – so thanks again


    That nearly did it but there was a problem with the syntax of the code. Should anyone else come looking, this is the code that did it for me. Entered in the <head> section of header.php. The numbers 406 refer to the page number for the blog page which – as was stated by the OP – is labelled as the post page:

    <?php if ( is_home(‘406’) ) {

    <link href=”” rel=”stylesheet” type=”text/css” media=”all”/>

    <?php } else { ?>
    <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo(‘stylesheet_url’); ?>” />
    <?php } ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘plse help troubleshoot css for specific page issue’ is closed to new replies.