简体   繁体   中英

Wordpress header.php displaying different CSS depending on page?

I'm currently in the process of converting my website to a wordpress site..and I've run into a problem

My homepage's header uses a different class than my single_page header They uses 2 different css IDs .

Right now I have the homepage which is using inside my header.php but what I want it to do is to display when you're on a page (is_page) How would I do that?

What you need is conditional tags: http://codex.wordpress.org/Conditional_Tags

if (is_page()) { do this }
elseif (is_front_page()) { do that }
else { do nothing? }

This question could help you also: Detect the browsed page from url in wordpress

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM