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

Talk:Stepping Into Template Tags

So my understanding of the Loop is that it refers to while( have_posts() ) : the_post(); - i.e., the part of the code that loops through each post in turn - and therefore it's not accurate to call it an "if/else" loop. It's a "while" loop, which is only executed if there are posts to loop through. If you were doing something totally crazy with your templates, such that you could safely assume that have_posts() were true, you could still invoke the Loop. It would be bad programming practice and the possibility should not even be mentioned to beginners, but you could do it.

IF and THEN do not translate to IF and ELSE. Php "else" means "otherwise"; THEN is more accurately represented by a set of curly braces {} or a colon.

I like the conditional tag examples, but I don't think they should be the first thing presented to a reader just learning how to deal with template tags. You're just trying to get across that some template tags need to be placed inside the Loop to work properly, and how this should be done, right? Maybe discussing simple uses of the_excerpt() or the_meta(), and then progressing to the examples of conditionals and other things that can be added, would be better. Also, the examples need real code along with the pseudocode.

I can try to take a shot at this myself tonight, if the stars are smiling on me and I have time...

yami 19:39, 7 Apr 2005 (UTC)

You were right on and my fear and concern about this vague stuff about the Loop, which I have repeatedly stated I still am far from understanding, is exactly right. I edited out the crap and simplified it. Much more informative and appropriate. Thanks for helping me see the "light". Lorelle 22:00, 7 Apr 2005 (UTC)

Bug in category children example?

When I use the code

<?php wp_list_cats('sort_column=name&sort_order=asc&optioncount=1&use_desc_for_title=0&child_of=3'); ?>

I'm only getting the children of category 3, not *all* of the top-level categories & *only* the children of Cat3. Am I missing something?

PaulFChapman 07:24, 13 Jan 2006 (GMT)

Updated the example in Template_Tags/wp_list_cats#Show_Children_Only_of_Category to describe according to PaulFChapman's experience
MichaelH (talk) 18:29, 13 Jan 2006 (GMT)