Created
November 9, 2017 22:20
-
-
Save jesgs/afbee9fd5a244c73353f44f7ac9439ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Theme view template example using locate_template | |
* | |
* @return string | |
*/ | |
function my_theme_template() | |
{ | |
// do view related stuff | |
$date = date('M j Y'); | |
$template_content = ""; | |
$found_template = locate_template(array('my-template.php')); | |
if (!$found_template) | |
return $template_content; // return empty if not found | |
ob_start(); | |
require_once $found_template; | |
return ob_get_clean(); | |
} | |
// EOF | |
?> | |
<?php | |
/** | |
* my-template.php | |
*/ | |
?> | |
Today's date: <?php echo $date; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment