Any tips or tricks on how to get a website to show a different stylesheet when you click on a menu item? What I want is one link to load a green css style and the other links keep the default style sheet. I am using U-Design.
Thanks in a advance!
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityAny tips or tricks on how to get a website to show a different stylesheet when you click on a menu item? What I want is one link to load a green css style and the other links keep the default style sheet. I am using U-Design.
Thanks in a advance!
You have to use Conditional Tags, with those, you can check in which page you are, and load a diferent stylesheet for each option.
A little example using is_page
if(is_page('about')){
echo '<link href="style1.css" rel="stylesheet" type="text/css" />';
} else {
echo '<link href="style.css" rel="stylesheet" type="text/css" />';
}
That should go in your header.php
file, or you could create diferent headers for diferent pages, and then use the get_header
function. There are other ways to deal with headers, but that's a diferent topic.