Title: Conditional CSS loading
Last modified: August 19, 2016

---

# Conditional CSS loading

 *  Resolved [loybuckz](https://wordpress.org/support/users/loybuckz/)
 * (@loybuckz)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/conditional-css-loading/)
 * I’ve been trying to create a conditional loading of stylesheet on a theme that
   I am trying to make. here is the code that i’m using:
 *     ```
       <?php if ( is_page() ); ?>
            <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?> /style2.css" />
       <?php else : ?>
           <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url') ?>" />
       <?php endif; ?>
       ```
   
 * i hope someone can help me. thanks in advance

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/conditional-css-loading/#post-1940296)
 * where is the problem?
 * maybe the use of ‘stylesheet_url’ in your first line?
 * try to use ‘stylesheet_directory’ instead.
 * [http://codex.wordpress.org/Function_Reference/bloginfo](http://codex.wordpress.org/Function_Reference/bloginfo)
 * edit:
    well spotted, Rev. – totally overlooked this 😉
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/conditional-css-loading/#post-1940298)
 * does this matter? (I’m no expert in php….)
 * you have:
 *     ```
       <?php if ( is_page() ); ?>
       ```
   
 * in my themes, I have
 *     ```
       <?php if ( is_page() ) : ?>
       ```
   
 *  Thread Starter [loybuckz](https://wordpress.org/support/users/loybuckz/)
 * (@loybuckz)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/conditional-css-loading/#post-1940303)
 * wohooo!!!
 * thanks Rev. Voodoo!!! now its working!
 * Thank you very much and God Bless!

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

The topic ‘Conditional CSS loading’ is closed to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [css](https://wordpress.org/support/topic-tag/css/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [loybuckz](https://wordpress.org/support/users/loybuckz/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/conditional-css-loading/#post-1940303)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
