I'm trying to create many different skins that apply depending on the page and the category of my Wordpress site. I am not sure of two things:
- How to use an or statement in PHP to call on the skin1.css stylesheet if
is_page('x')
OR ifis_category('1')
. (On that note, how do you specify multiple pages and/or categories in the same line? - Why is the following code displaying as text in the header of my web site?
- There must be a better way to write these if else statements. Any tips?
I know this is a mess.
< ?php if (is_page( 'health' ) ) { ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/skins/health-skin.css" />
< ?php } elseif (is_page( 'beauty' ) ) { ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/skins/beauty-skin.css" />
< ?php } elseif (is_page( 'home' ) ) { ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/skins/home-skin.css" />
< ?php } elseif (is_page( 'food' ) ) { ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/skins/food-skin.css" />
< ?php } elseif (is_page( 'travel' ) ) { ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/skins/travel-skin.css" />
< ?php } else { ?>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/skins/default-skin.css" />
< ?php } ?>