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 [2013/04/12 09:06]
Timbow [Pages in this Section]
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>​
Line 17: Line 17:
 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====== ======Links======
 Back to the GetSimple Wiki [[:​start|Contents Page]] Back to the GetSimple Wiki [[:​start|Contents Page]]
-====Pages in this Section====+==Pages in this Section==
 ===Themes=== ===Themes===
   *[[themes:​installation|Ready-Made Themes]]   *[[themes:​installation|Ready-Made Themes]]
Line 37: Line 44:
   *[[themes:​tips|Theme Development Tips]]   *[[themes:​tips|Theme Development Tips]]
  
-====Other Pages and Links====+==Other Pages and Links==
theme/template_code_snippets.1365757618.txt.gz ยท Last modified: 2013/04/19 14:57 (external edit)