This post is a short review of both tags (in plugin or hooked by plugin).
Template tags are sometime included in widgets.
(from time to time, this post will be completed)
As described here in codex, WordPress provides infinite ways to enrich core behaviours. The writing adventure for create this plugin, is a permanent research in the hooks catalog and the wordpress source began since version 2.3.
The first research : creating API for current template tags,
The second research : design specific template tags for the plugin itself or to replace unadapted tags of WordPress core.
The results are in the 2 others tabs of this post…
New template tags
Specific template tags :
1) The list of current available languages of the website :
xili_language_list($before = '<li>', $after ='</li>', $theoption='')
On this site, it is inserted in top menu (the flags), in sidebar (through widget).
2) For one post, it gives the list of linked posts in other language about this subject :
xiliml_the_other_posts ($post_ID,$before = "This post in", $separator = ", ")
In single full post, it is visible (if possible) under the title.
3) Template Tag insertable in search form for sub-selection of a language
Sometime, hooks are lacking, so some new tags were designed.
a) The translated list of categories of a post (replace the_category()) :
xiliml_the_category($post_ID, $separator = ', ' ,$echo = true)
More details are present in the plugin code before each function.
Template tags "hooked" by xili-language
Here below a list a template tags which are « modified » in their display results by xili-language :
1) Categories list
Through 3 hooks, the categories list
display translated name, description and link (as visible here on the right).
2) Archives month list
Archives tags is a very complex template tag in his background and not very easy hookable source. So we decided to add few features : by adding query in vars of the function, it will be possible to display a monthly list of archives for a selected language
or the current the theme language
The displayed list of links will be translated and link restricted to display only archives of this language.
3) Pages list :
When xili-language is activated, the template tag is able to use « lang » query tag :
* example 1 :
will display only pages of current lang
* example 2 :
will display pages of current lang AND pages with lang undefined (polyglot pages).