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
Last revision Both sides next revision
theme:template_code_snippets [2013/04/19 15:04]
127.0.0.1 external edit
theme:template_code_snippets [2013/09/18 15:16]
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>​
  
-======Links======+==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]] 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.txt · Last modified: 2013/09/18 15:16 by datiswous