WordPress.org

Codex

Talk:Template Tags

Contents

Notice on adding tag pages

The Template Tags list is far from complete, and anyone wishing to add previously undocumented tags to it are certainly welcome. However, before creating a new page for a template tag, please follow the Codex guidelines for creating new pages. The guidelines are especially important here, as more than just the Template Tags page must be modified to list them.

Thanks.

-Kaf 21:44, 23 Jan 2005 (GMT)


skippy 20:09, 3 Aug 2004 (UTC): Should we use transclusion, like Carthik's use of {{Stub}}, to include the Tags_Without_Parameters and Passing_Tag_Parameters blocks inline on each template tag?

skippy 13:09, 30 Jul 2004 (UTC): Do we want the links to sub-pages to clearly indicate their provenance: Template_Tags/Some_Tag; or should we present a less cluttered link to the reader: Some Tag

ChrisL 07:31, 4 Aug 2004 (UTC): I'd vote not to have the clutter on every page for every tag, myself. As for the links, it makes sense to me to use the less cluttered link form-- I don't think it is really material to the general reader to indicate the subpage? Just my .02

The stub thingy is what is called a BoilerPlate, I guess, and is useful to add the same piece of text over and over again, on several pages, so Skippy, I think that sounds like a good idea.

Carthik (not logged in -- public computer)


Close to a finish line of some sort here. Yeah, I know, documentation is never finished. Nevertheless, over the past few days I've gone through every tag and performed a lot of clean-up. Some tags need a few more helpful examples, but at this point I want to focus on standardizing the little details in tag page layout, such as making sure parameter options are in li lists instead of just mentioned in the dt, and setting boolean (true/false) values the same throughout (TRUE, or true, but not both).

Input appreciated before I start the nitpick portion of my tag page edits. -Kaf 08:43, 3 Jan 2005 (GMT)


Oh hey, almost forgot. I'd like to suggest a couple mods to Template_Tags and associated ephemera:

  1. Combine Link and Permalink ("Permalink and Link Tags"). They sort of go together.
  2. Move all RSS-specific tags under their own group. I'm thinking they need it.

Yea? No way Jose? -Kaf 09:02, 3 Jan 2005 (GMT)


The template list is looking great, but we have a little quandry. Is this the template list for 1.2 or 1.5?

Lorelle 05:08, 4 Feb 2005 (GMT)

Both. Part of the work we were doing (and guess still are) was documenting the changes to existing tags, for example the new parameters for bloginfo(). New tags such as wp_list_pages() will need a disclaimer noting they are not available in versions prior to 1.5. -Kaf 06:14, 4 Feb 2005 (GMT)

How do you recommend separating the old from the new? I see there is the use of Deprecated, which could mean no longer good for even v1.2 or is that for 1.5? I think having them astericked or highlighted in a very simple way would be good. Lorelle 01:23, 11 Feb 2005 (GMT)

At least on Template Tags, flagging with a [1.5 only] should do.
Deprecated tags are primarily those hit by the introduction of multiple categories back in WordPress 1.0. But use of the term reflects whatever version of WordPress is current; if/when a tag is finally taken out of the source, there'll be no support for it and the tag should be removed (at that point a separate "no longer supported" tag list would probably be added).
-Kaf 02:14, 11 Feb 2005 (GMT)

Some new things?

Kaf, what do you think of USER:MDAWaffe/get_some_templates (Include Tags) for inclusion under the General Tags section? Didn't know what to call it. "Include Tags"? --MDAWaffe 00:46, 8 Feb 2005 (GMT)

I'm also having trouble deciding where a document that will discuss the is_* functions belongs, because they (and to some degree the Include Tags (which seems the best name)) are not *regular* template tags. Perhaps it would be better to set up a top-level "Working with Templates" page (to replace Template Files|Template File Structure MDAWaffe) and use that to point in some logical manner to the various template-ish info. I find use of Template Tags for this problematic. Thoughts?
Kaf 01:38, 8 Feb 2005 (GMT)
That's an excellent idea. There's a couple Theme pages, but nothing really about Templates (except what is found on the Theme pages, such as Theme Development). Pages could be referenced from there, as could a similar doc on my todo list based on this forum post. It'd be a great place for is_{X} as you mention, as well as a description of the corresponding template hierarchy (i.e. category.php > archive.php > index.php). Template Tags should be reserved for... Template Tags, not all Template oriented material.
The problem I had with "Include Tags" is that you run into some noun vs. verb issues (at least in English). "Does the page describe how to include tags in a template, or does it talk about the include tags?" --MDAWaffe 01:52, 8 Feb 2005 (GMT)
The Include Tags would resolve grammatical issues definitively... -Kaf 02:26, 8 Feb 2005 (GMT)
So it would :) --MDAWaffe

A Tag Tags

I just thought I'd pitch and say that maybe we need a definition for what a template tag is, and maybe we could agree that a template tag is that which can be used by the user to directly acheive some textual output on a page displayed to the world. This would exclude functions whose output can be used by other functions and functions that return a boolean, for example. The distinction needs to be made since it would be nice if the "templatetags" are usable by a normal non php-geek, while the php geek can lookup functions and decide how best to use them to cook her soup. Usually template tags are contained in the template-functions-x.php or functions-general.php or functions.php (in that order)

Maybe we can call the other useful functions just that - "Useful Functions". Other names could be "Utility Functions" or "Advanced Tags". The is_* functions could be called "Identifier Functions". get_some_templates functions could be called "Include Tags" (which is nice) :)

Carthik 08:23, 8 Feb 2005 (GMT)

Nomenclature! I'll avoid too long a comment, as I've been accused in the past (for good reason) of placing far more emphasis on the underlying subject matter than may be absolutely necessary. Carthik's delineation is pretty much mine, in that a template tag represents the display of a blog's information, whereas a "useful function" deals with blog and template structure. However, I do think we should retain official WP terminology and refer to each as a group of tags. So my take would be:

  • Template Tags => Class of WP functions for displaying or returning blog content.
  • Advanced Tags => All other user-available functions, among which are:
  • Include Tags => get_some_template functions.
  • Ident Tags => is_* functions.

I like the sound of "Advanced Tags," but perhaps "Utility" describes them better.
-Kaf 18:11, 8 Feb 2005 (GMT)

Kaf, yes, dude, I was merely collating pre-existing definitions and stuff, so it is stated explicitly and in one place, and so that new stuff is better organized. I think replacing "tags" with "functions" for everything except template tags above is fine, and can be followed, as long as there is the one thing and no other. (I rememeber the old joke that the good thing about Standards is that there are so many to choose from among.) Calling them "tags" instead of functions attempts to make the barrier for their usage lower, and to distinguish them from the ever-so-many user-defined functions, in plugins and such.
Carthik 18:43, 8 Feb 2005 (GMT)
To clarify: I am NOT for using "function" in place of tag. We should stick with already accepted WP nomenclature unless there's an extremely good reason to divert from it. -Kaf 19:36, 8 Feb 2005 (GMT)
Off the cuff: I think of Tags in the context of HTML Tags. So, Tags are those that do something specific (like insert text) at a specific point in the document. Functions which are not Tags, then, are those which are used to alter the entire flow of the document. In that since, then, the is_ functions are not tags (taking the converse to be implicit in each definition). If is_ are tags, aren't isset() and function_exists() and so forth?
And I sort of like "Where the Hell am I Functions" or "20 Questions Functions" or "I'm Asking the Questions Here Functions" for is_. --MDAWaffe 21:41, 8 Feb 2005 (GMT)
It's likely the goal was to make a comparison with HTML tags by naming them so, but they are tags in their own right: using "tag" to describe a function within <?php  ?> is proper form. Beyond these, if we can find a way of making functions like the is_* set clear to the casual user without referring to them as tags, I say do it. It's just that by calling them something like Ident functions (or is_* functions, blech!), the connection with other user template "tags" is lost. Perhaps a good thing?
-Kaf 06:19, 9 Feb 2005 (GMT)
I agree with the use of "tag" for, say, <?php the_ID(); ?>. Originally, I think tags were called "tags" because they tagged what they surrounded (or their postion in the case of something like <br />) for some, specific formatting. PHP tags came along and extended the definition: "tag this position for the inclusion of something". But I still don't see is_ as being tags. They don't tag their position for anything. In fact, they don't even have a postion in the final HTML document. They're used in flow control only.
Actually, I'm being unfair. if ( is_ ) tags what it surrounds for inclusion, based on some criterion. So I suppose they can perfectly well be called tags also. The is_ are never used without if so maybe "Conditional Tags"? --MDAWaffe 06:54, 9 Feb 2005 (GMT)
"...so maybe "Conditional Tags"?" Ooh ooh! Me like. :) -Kaf 18:03, 9 Feb 2005 (GMT)

Some new Template Related Stuff

If you're really into history, check out this discussion page's to see what was here before. It was just a note about various articles now available from Templates. Naturally, all discussion about them should go on their discussion pages. --MDAWaffe 20:54, 6 Mar 2005 (UTC)

I've added a couple links up top (rather than in the General Tags section). Mainly, I didn't quite know where to put them. If they are better served somewhere else in the article, please move them. --MDAWaffe 21:24, 6 Mar 2005 (UTC)

Most Used Tags

What do you think about a list of the tags people use about most typically: wp_list_cats, wp_get_archives, wp_list_pages, wp_get_links. The listing ones are the ones that pop into my head. It'd be nice to put those together so that people can more easily contrast them. If you look Talk:Template Tags/wp_list_pages, for example and many places in the forums, it becomes clear that new users might find figuring out what each can do a little confusing. Or is this better on a separate, How-To-ish page? --MDAWaffe 11:07, 10 Feb 2005 (GMT)

Maybe "most used" is a misnomer. Do you see what I'm getting at, though --MDAWaffe

wp-plugins.org expired domain

Looks like wp-plugins.org is dead. It expired July 16th and has not been renewed.