Yes, I saw and read the codex carefully more than once.
There are 3 things I’d like to point at from that article.
First, it is marked as in need of editing. I’d love to help and do that, but I’m obviously not knowledgeable enough in that domain as I’m requesting help regarding the very topic.
Second, the part that is of most interest for me (“The Custom Category Template”) barely has any explanation, just a full page of code in which noobs like me get lost. In addition, it seems strange to me that it relies on a plugin to work. If you want to remove the part of the code that concerns the plugin (which creates a random list of posts of a category, which I don’t care for) you’re on your own: there are no comments indicating where and what is happening in there. I suppose that the earlier cases looked at before we get to the custom category template file are supposed to make it obvious to all, but it doesn’t, not for me anyway.
And lastly,
This is not for the timid, and familiarity with PHP syntax and WordPress template tags is recommended.
Of course. Should I dig my own grave or look for some help in the forums? I am not timid, but I am unfamiliar with both. I thought that’s why there were articles, a codex and support forums.
Seriously, I know some people just don’t read the codex and the articles and get straight to the forums. I didn’t, and I need help. I think I want to do something that is the topic of at least one of those articles, but I can’t do it.
I’m sorry I sound frustrated: I really am. I’ve been at this for a while now, and I can’t seem to get it. I’m very confused as I tried many things with too many files and code I don’t master. Code is poetry, sure, but I hardly get the language. The article does cover many cases, however I don’t feel like I relate to them.
Use what you have learned and put the whole thing together so you can see it in action, one category.php
that generates custom information for each category on your site.
This is exactly what I want. However, I find more explanation in another article: Different Formats for Different Categories and Different CSS For Different Categories (The Loop in Action) I can use the examples to create a single category.php
with a conditional test to figure out which category is being shown and apply the theme (template and CSS files) corresponding to that category. And here’s what I come up with:
<?php if (in_category('2') ):
// we're in David's category, so show David's theme ?>
<-- I need to put the code to point to David's theme -->
<link rel="stylesheet" href="<?php get_template_directory(); ?>/wp-content/themes/David's_theme_dir/style.css" type="text/css" media="screen" />
<?php } elseif (in_category('3') ):
// we're in Brian's category, so show Brian's theme ?>
<-- I need to put the code to point to Brian's theme -->
<link rel="stylesheet" href="<?php get_template_directory(); ?>/wp-content/themes/Brian's_theme_dir/style.css" type="text/css" media="screen" />
<?php elseif (in_category('4') ):
// we're in Frank's category, so show Frank's theme ?>
<-- I need to put the code to point to Frank's theme -->
<link rel="stylesheet" href="<?php get_template_directory(); ?>/wp-content/themes/Frank's_theme_dir/style.css" type="text/css" media="screen" />
<?php } elseif (in_category('5') ):
// we're in Alex's category, so show Alex's theme ?>
<-- I need to put the code to point to Alex's theme -->
<link rel="stylesheet" href="<?php get_template_directory(); ?>/wp-content/themes/Alex's_theme_dir/style.css" type="text/css" media="screen" />
<?php endif; // end the if, default theme for other categories ?>
It doesn’t work. I was pretty sure it wouldn’t because I haven’t yet pointed to the right header.php
, or index.php
of the category’s theme. I don’t even get a screwed default theme when I click on the categories… is it even reading the CSS files?