Template functions explained

The file include/template-functions.php is holding all the functions as used in the template file.

Text in brackets ([]) in this text is variables defined in the settings or automatically.

<?php title_tag(); ?>

Will print out:

[Title of the page] | [Title of the site]

Exemple for this page:

Template functions explained | Clesto

But if it is the home page and a custom title element of your home page is set from the settings it will print out:

[Custom title element of your home page]

<?php home_url(); ?>

Will print out the URL to the home page of the installation including trailing slash. Example:

http://www.domain.com/

<?php page_url(); ?>

Will print out the URL to the current page. Same as a permalink.
Example for this page:

http://www.clesto.com/template-functions-explained

<?php meta_tags(); ?>

Will print out the following:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Clesto.com [version]" />
And if copyright text is defined in the settings:
<meta name="copyright" content="[Copyright text without HTML]" />
And if the page has any meta description:
<meta name="description" content="[Meta description of the page]" />
And if the page has any meta keywords:
<meta name="keywords" content="[Meta keywords of the page]" />
And if a template is being previewed outside the settings:
<link rel="canonical" href="[URL to the page]" />

<?php template_path(); ?>

Will print out the URL path to the current template without trailing slash.
Example for this site:

templates/jwdefault

<?php css_file(); ?> (new)

Will print out the URL to the style.css.
Example for this site:

http://www.clesto.com/templates/jwdefault/style.css

This new function enables editing of CSS files.

<?php site_title(); ?>

Will print out the web site title as defined in the settings.
Example for this site:

Clesto

<?php site_description(); ?>

Will print out the web site description as defined in the settings.
Example for this site:

A Really Simple CMS

<?php page_title(); ?>

Will print out the title of the page. Should be used in an <h1> on the page.
Example from this page:

Template functions explained

<?php navigation_ul(); ?>

Will print out the following:

<ul id="nav">
	<li><a href="[URL of page 1]">[Button 1]</a></li>
	<li><a href="[URL of page 2]">[Button 2]</a></li>
	<li id="active"><a>[Button 3]</a></li>
	<li><a href="[URL of page 4]">[Button 4]</a></li>
	<li><a href="[URL of page 5]">[Button 5]</a></li>
</ul>

The list continue to include all the 10 buttons as set in the settings.

Notice that the list have an ID of "nav" and that the active page has an ID of "active" for easy styling with CSS.

<?php content(); ?>

This one will print out the content of the page including administration links if that option is turned on in the settings and the person viewing is logged in.

<?php fixed_textbox(); ?>

Will print out the content of the fixed textbox if it exist. A template does not need to have this function.

<?php copyright(); ?>

Will print out the copyright as defined in the settings. Example for this site:

© 2009 <a href="http://www.jimwestergren.com">Jim Westergren</a> AB. All Rights Reserved.

<?php statistics(); ?>

Will print out statistics tracking if that option has been turned on in the settings. Tracking code is to be pasted and saved in the editor.