Forums

[resolved] Conditional CSS loading (4 posts)

  1. loybuckz
    Member
    Posted 1 year ago #

    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

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    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

    edit:
    well spotted, Rev. - totally overlooked this ;-)

  3. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    does this matter? (I'm no expert in php....)

    you have:

    <?php if ( is_page() ); ?>

    in my themes, I have

    <?php if ( is_page() ) : ?>
  4. loybuckz
    Member
    Posted 1 year ago #

    wohooo!!!

    thanks Rev. Voodoo!!! now its working!

    Thank you very much and God Bless!

Topic Closed

This topic has been closed to new replies.

About this Topic