Short pieces of code to use in Template-files (from the Forum).

Template Code Snippets

returnPageContent()
<?php returnPageContent(); ?>

Since 3.1 this Caching/Indexing function can be used to check the page content (example: conditionals).

global $content;
<?php global $content; ?>

Since 3.1. Similar to returnPageContent() this can be used to check the page content.

output author
<?php echo $data_index->author; ?>
<?php getPageField(return_page_slug(),'author'); ?>
<?php echo stripslashes(html_entity_decode($data_index->author, ENT_QUOTES, 'UTF-8') ); ?>

The last example is for output of Unicode characters.

conditional by template
<?php if ($template_file == 'name-of-template.php') {
...

If used in a component, first do:

global $template_file;
conditional by page (slug)
<?php if (return_page_slug() == 'contact') {
...
template ready for but not requiring a plugin

If for example you want to make a template ready for the Custom Title plugin but to work normally without it:

<title>
		<?php if (function_exists('get_custom_title_tag'))
		{echo(get_custom_title_tag());}
		else { get_page_clean_title(); }  ?>
</title>

Links

Back to the GetSimple Wiki Contents Page

Pages in this Section

Themes