Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Function Reference/in category

This is a really powerful tag. Could we have something a little more specific here? Just a tiny example of how this would be used. I can only assume that this would be a check to see that if the post is in X category, it would print out some introductory text, lists, or some other information wherever this tag was placed. Can it be used multiple times in the same plaxce for IF/THEN statements? So can the tag be put in the header, index, footer, sidebar menu...? Where?

Lorelle 17:53, 4 Feb 2005 (GMT)

Lorelle, yes you can use it multiple times, as all it does is tell you if post x belongs in category 'y'. The Usage example is fairly simple and tells you how you could use if for an if statement.

Carthik 22:18, 4 Feb 2005 (GMT)
After much thinking about this, and some sleep, I realized what is really bugging me about this particular code and what I'm really asking. As concise as we want these explanations (no matter what the subject), people have to FIND the information they need. The eleven word explanation, without keywords, isn't enough to help a searcher find the page within most search engines. We have to remember the Codex is to be used...to be used, "information" (some related words) must be found. So I nag not so much for myself but for the rest of us hunting.

Lorelle 16:01, 5 Feb 2005 (GMT)

This and many pages on Codex will be created by someone who possibly:
  • Has little to no background in writing help docs.
  • Does not follow the guidelines.
  • Adds no futher content to Codex, or even returns.
  • Knows just enough about the subject matter to compose eleven words on it.
We can't control any of this, but when such a page appears, the documentation team has a number of choices, among which are:
  1. Remove it (if appropriate).
  2. Merge it with another document (again, if appropriate).
  3. Take ownership of it or ask someone else to, and do what we can to expand the material.
  4. Leave it and expect (or at least hope) someone can add to it later.
I sort of have in_category on my todo list, if only because I've become most active in maintaining the Template Tags content. To properly cover it I'll have to dig into the function to learn more about it, write up something, dig a little more to make sure I haven't gotten it wrong, and make things tidy and conforming to the layout used for the template tag pages. Now if someone else was to come along and do all this, I really wouldn't mind at all...
Kaf 17:22, 5 Feb 2005 (GMT)

Give me a week or so...okay, maybe a year, and I'll have enough knowledge to know what I'm doing so I can dig into things more. In the interium, consider me one of the codex's nags. When it happens it happens. This is looking so great, building and growing, no excuses are necessary. It's the purpose of the process. Thanks for what you do do. Lorelle 06:10, 7 Feb 2005 (GMT)

in_category can be used outside of the loop. I have made this change to the documentation.