My client wants to implement a special appearance to each of our category pages. Kind of like child themes… she wants to shift the background image, change a few graphics, and tweak the colors according to which category the user is visiting (horror, romance, etc).
Is there a reasonable way to do this besides creating a different template for each page with imported CSS styles? Or is that really the only path to accomplish this?
UPDATE:
The answers below are all great. For our purposes, the easiest thing to do was to use the category specific classes provided by “body_class()” to override current styles.
Thanks!
If changes do not require modifications to HTML markup you can accomplish that by loading conditionally additional CSS style files. See Conditional Tags > A Category Page and
wp_enqueue_style()
in Codex.The bulk of your theme is made up of three files, header.php, footer.php and style.css.
If you want to load an alternative header, footer and/or stylesheet simply update the appropriate calls inside the category template(category.php) to pull in a different header/footer/stylesheet.
Example.
Becomes.
Would then include header-cat.php instead of header.php.
You can do the same with the
get_footer()
call to include a different footer file.Using alternate header/footer files is covered on the Codex pages.
http://codex.wordpress.org/Function_Reference/get_header
http://codex.wordpress.org/Function_Reference/get_footer
For the stylesheet, simply change this(in your new header file).
For something like..
Or alternatively, use
wp_enqueue_style
as suggested in the other answer.Completely custom HTML and CSS without effecting any other kinds of pages(and no changes needed to the existing header/footer/stylesheet).