php - How do I create per page and per category stylesheets in Wordpress? -
i'm trying create many different skins apply depending on page , category of wordpress site. not sure of 2 things:
- how use or statement in php call on skin1.css stylesheet if
is_page('x')
or ifis_category('1')
. (on note, how specify multiple pages and/or categories in same line? - why following code displaying text in header of web site?
- there must better way write these if else statements. tips?
i know mess. bare me , in advance. i'm learning php go , once project complete, i'll sit down , digest language , practices.
< ?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 } ?>
&& //=and || //=or !== //=not same ! //=not
This is a amazing post. This article is good . For more detail in briefly click here
ReplyDeleteHOW TO USE OPERATOR IN PHP