I was asking in the forums about the wordpress conditional template tags in blogsome. In classic wordpress world, these conditional tags will allow us to find out if a particular page being viewed is a single post page, an monthly archive etc. However, those tags seem to have been disabled in blogsome. If you attempt to use these in your template, you will get an unrecognized tag error.
No Worry, Matt Schinckel to the rescue ! He gave me nice pointers on how to work around this limitation. There are other template tags like single_post_title, single_cat_title that will help determine in this conditional template processing.
- To check for main page
{if $smarty.server.REQUEST_URI == '/'}{* you are looking at the main page *} - To check for a single post page:
{capture name='post'}{single_post_title}{/capture}{if $smarty.capture.post}{* This is a single post page *} - To check for a category page:
{capture name='cat'}{single_cat_title}{/capture}{if $smarty.server.REQUEST_URI | truncate:10:"":1 == "/category/" && $smarty.capture.cat }{* this is a category page *} - To check for a search result page:
{if $smarty.server.REQUEST_URI | truncate:10:"":1 == "/category/" && $smarty.request.s }{* this is a search result page *} - To check for an individual page:
{if $smarty.server.SCRIPT_NAME == '/wp-inst/pages'}{* this is an individual page *} - Checking for date-based archives can be tricky as the code
{single_month_title}monthname4digitYear (for e.g. September2006) and nothing for an yearly archive. Possibly this code may do the trick{capture name='cat'}{single_cat_title}{/capture}{if $smarty.server.REQUEST_URI | count_characters <= 12 && $smarty.server.SCRIPT_NAME != '/wp-inst/pages' && $smarty.request.s == "" && $smarty.capture.cat == "" }{* this is not a page, not a search result page and not a category based page -- must be a date archive page ?? *}
Voila!








Try http://blogsome-docs.blogsome.com/docs/smarty-funcs/
is there any official site that explain all the smarty code?
thanks for this advice… will take in count!!