[wp-docs] Differences between Template Tags and Functions

Jacob Santos wordpress at santosj.name
Thu May 29 03:36:02 GMT 2008


I know to some degree if you start speaking about programming, then most 
would be developers would start tuning you out very quickly. However, 
the term is not accurate when a developer starts looking at code. The 
terms, "template tag" and "function" are the used in the same context.

Well, that is to say Template Tags are functions. It is to also say that 
not all functions are template tags. Just because a function can be used 
within a template does not make it a template tag.

While I was editing wp_count_posts() Codex page [1], I noticed that it 
is under the Template Tag category. However, it is not within one of the 
*-template.php files, it is in the post.php file. This lead me into some 
confusion, as most functions, which would be referred to as Template 
Tags are within the *-template.php files.

I would move the page, but I'm a n00b to the Codex, so I dare not 
displease the gods. In my opinion, it should be. Am I wrong with my 
assertion?

It also leads some confusion with a co-worker and myself. We both 
thought that Template Tags are majority used within The Loop, however 
this might be narrow thinking on our part. Doing some checking, any 
Template Tag can be used outside The Loop easily, well it would take 
some global hacking in order to do so.

My question is, where do you draw the line between functions (which 
developers look for) and template tags which non-developers look for?

[1] http://codex.wordpress.org/Template_Tags/wp_count_posts

-- 

Jacob Santos

http://www.santosj.name - blog
http://funcdoc.wordpress.com - WordPress Documentation Blog/Guide Licensed under GPLv2

Also known as darkdragon and santosj on WP trac.



More information about the wp-docs mailing list