0

Hi I am new to WordPress I want to use a a different CSS for my landing page named 'as'. I have a default style sheet style.css , jquery-bxslider.css and responsive.css. I don't want to use style .css whereas I want to use other two to be applied on my particular page.

**images:

Directory structure:** enter image description here

WP header: enter image description here

WP- css:

enter image description here

1
  • Please, post code instead of a snapshot of code. Commented May 20, 2014 at 7:53

2 Answers 2

1

You should use wp_enqueue_style() to add stylesheets to your template.

function add_stylesheets() {
    wp_register_style( 'style', get_stylesheet_uri() );
    wp_register_style( 'bxslider', get_template_directory_uri() . 'jquery.bxslider.css' );
    wp_register_style( 'responsive', get_template_directory_uri() . 'responsive.css' );

    wp_enqueue_style('style'); // enqueue style.css everywhere

    ## if( ! is_page_template('landingpage.php') ) // enqueue style.css everywhere except if the page template is landingpage.php
    ##    wp_enqueue_style('style');

    ## if( ! is_page(ID) ) // enqueue style.css everywhere except page id = ID
    ##    wp_enqueue_style('style');

    ## if( is_home() || is_front_page() ) // enqueue style.css in homepage only
    ##    wp_enqueue_style('style');

    wp_enqueue_style('bxslider');
    wp_enqueue_setyle('responsive');

}

add_action( 'wp_enqueue_scripts', 'add_stylesheets' );
Sign up to request clarification or add additional context in comments.

Comments

0

You can do this by checking the current page ID and setting the respective css

For E.g in header

$page_id     = get_queried_object_id();
if($page_id==1)
    //include the respective css
elseif($page_id==2)
    //include the respective css
elseif($page_id==3)
    //include the respective css

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.