User Tools

Site Tools


theme:template_code_snippets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
theme:template_code_snippets [2012/03/14 09:08]
ChriS
theme:template_code_snippets [2013/09/18 15:16] (current)
datiswous [Links]
Line 3: Line 3:
 ====== Template Code Snippets ====== ====== Template Code Snippets ======
  
-**returnPageContent()** +==returnPageContent()==
 <​code><?​php returnPageContent();​ ?></​code>​ <​code><?​php returnPageContent();​ ?></​code>​
 Since 3.1 this Caching/​Indexing function can be used to check the page content (example: conditionals). ​ Since 3.1 this Caching/​Indexing function can be used to check the page content (example: conditionals). ​
  
-**global $content;** +==global $content;== 
 <​code><?​php global $content; ?></​code>​ <​code><?​php global $content; ?></​code>​
 Since 3.1. Similar to returnPageContent() this can be used to check the page content. ​ Since 3.1. Similar to returnPageContent() this can be used to check the page content. ​
  
-**output author ​** +==output author== 
 <​code><?​php echo $data_index->​author;​ ?></​code>​ <​code><?​php echo $data_index->​author;​ ?></​code>​
 <​code><?​php getPageField(return_page_slug(),'​author'​);​ ?></​code>​ <​code><?​php getPageField(return_page_slug(),'​author'​);​ ?></​code>​
-<​code><?​php echo stripslashes(html_entity_decode($data_index->​user, ENT_QUOTES, '​UTF-8'​) ); ?></​code>​+<​code><?​php echo stripslashes(html_entity_decode($data_index->​author, ENT_QUOTES, '​UTF-8'​) ); ?></​code>​
 The last example is for output of Unicode characters. ​ The last example is for output of Unicode characters. ​
  
-**conditional by template**+==conditional by template==
 <​code><?​php if ($template_file == '​name-of-template.php'​) { <​code><?​php if ($template_file == '​name-of-template.php'​) {
 ...</​code>​ ...</​code>​
Line 23: Line 23:
 <​code>​global $template_file;</​code>​ <​code>​global $template_file;</​code>​
  
-**conditional by page (slug)**+==conditional by page (slug)==
 <​code><?​php if (return_page_slug() == '​contact'​) { <​code><?​php if (return_page_slug() == '​contact'​) {
 ...</​code>​ ...</​code>​
 +
 +==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:
 +<​code><​title>​
 + <?php if (function_exists('​get_custom_title_tag'​))
 + {echo(get_custom_title_tag());​}
 + else { get_page_clean_title();​ }  ?>
 +</​title></​code>​
 +======Links======
 +Back to the GetSimple Wiki [[:​start|Contents Page]]
 +==Pages in this Section==
 +===Themes===
 +  *[[themes:​installation|Ready-Made Themes]]
 +  *[[themes:​creation|Theme Creation]]
 +  *[[themes:​template_tags|Complete Template Tags Reference]]
 +  *[[theme:​template_code_snippets|Template Code Snippets]]
 +  *[[themes:​tips|Theme Development Tips]]
 +
 +==Other Pages and Links==
theme/template_code_snippets.1331716122.txt.gz ยท Last modified: 2013/04/19 14:57 (external edit)