WordPress.org

Support

Support » Themes and Templates » CSS stylesheet to apply on static posts page.

CSS stylesheet to apply on static posts page.

  • roburdick
    Member

    @roburdick

    I am using thematic with a custom child theme. I have selected a page to be a blog page and another to be a static front page in the settings/reading section of the admin panel. I have successfully applied alternate style sheets on other pages using the functions.php file, but can’t seem to apply one on the ‘blog’ page that i specified in the admin reading/settings panel.

    Does anyone know how to do this?

    Thanks in advance

    Rob

Viewing 2 replies - 1 through 2 (of 2 total)
  • roburdick
    Member

    @roburdick

    Found a solution:

    in the funtions.php file I added another stylesheet rule like this:

    if(is_home() )
    $stylesheet_uri = $stylesheet_dir_uri . ‘/stylesheet_name.css’;

    The reading setting makes your posts page a ‘home’ page. Luckily this has not affected my actual home page (the drop down otion above in the reading settings panel). My home page has another stylesheet applied to it.

    For anyone wanting to see my exact function snippet to apply different stylesheets, here it is:

    // PAGES CSS
    add_filter( ‘stylesheet_uri’, ‘my_stylesheet’, 10, 2 );

    function my_stylesheet( $stylesheet_uri, $stylesheet_dir_uri ) {

    if(is_home() )
    $stylesheet_uri = $stylesheet_dir_uri . ‘/style-about.css’;
    if ( is_page( ‘team-building’ ) )
    $stylesheet_uri = $stylesheet_dir_uri . ‘/teambuild.css’;
    if ( is_page( ‘the-canape-challenge’ ) )
    $stylesheet_uri = $stylesheet_dir_uri . ‘/teambuild_cat.css’;
    elseif ( is_page( ‘Contact form’ ) )
    $stylesheet_uri = $stylesheet_dir_uri . ‘/form.css’;

    return $stylesheet_uri;
    }

    Hi,

    I am trying to do something similar for a client. I built a custom theme using HTML & css, and then ran it through Themeshaper.com to create my WP theme.

    Now I want to go back and create a custom static home page. I have successfully done this, but I am not sure how to link it up to the custom CSS. I created a CSS file specifically for this page called homepage.css. My home page file is called home.php. I FTP both into my theme folder and now the home.php is my home page, but the css is not linked.

    Help anyone?

    here is the site:
    http://desiblu.com/FrankLove/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CSS stylesheet to apply on static posts page.’ is closed to new replies.