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.
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.
pushpinderbagga
Member
Posted 7 months ago #
The one you started with works
you just put a : instead of a ;
This one works for sure
<?php if (is_page(1)); ?>