WordPress.org

Ready to get started?Download WordPress

Forums

CSS stylesheet to apply on static posts page. (3 posts)

  1. roburdick
    Member
    Posted 4 years ago #

    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

  2. roburdick
    Member
    Posted 4 years ago #

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

  3. desiblu
    Member
    Posted 4 years ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Topic