• Resolved Ramzii

    (@ramzii)


    After hours of modding and searching I found this:

    <?php if (is_page(1)):?>
    <link rel="stylesheet" href=<?php echo bloginfo('template_directory'); ?>/css/svib.css" type="text/css" /> <?php else:?> <link rel="stylesheet" href="<?php echo bloginfo('template_directory'); ?>/css/index.css" /> <?php endif;?>

    And guess what, it aint working.

    My css files need to differ per certain pages, how do I accomplish this??
    All help is appreciated thanks a bunch.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Ramzii

    (@ramzii)

    bumpersticker

    Thread Starter Ramzii

    (@ramzii)

    so..no one knows?

    Thread Starter Ramzii

    (@ramzii)

    Seriously.. it wasnt that hard of an answer:

    //switch depending on the page_id
    switch($_GET['page_id'])
    {
    //if page_id is id1, use stylesheet1
    case 'id1':
    echo "<link href='stylesheet1.css' rel='stylesheet' type='text/css' media='screen' />";
    break;
    
    //if page_id is id2, use stylesheet2
    case 'id2':
    echo "<link href='stylesheet2.css' rel='stylesheet' type='text/css' media='screen' />";
    break;
    //etc.
    //if it is none of them, the default should be this stylesheet: (this can be removed)
    default:
    echo "<link href='defaultstyle.css' rel='stylesheet' type='text/css' media='screen' />";
    }

    Hope someone saves a heap of time and finds this topic.

    The one you started with works

    you just put a : instead of a ;

    This one works for sure

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘need a code for external stylesheers per page_id’ is closed to new replies.