Created
June 6, 2013 17:23
-
-
Save jesgs/e08e9a7b1308faf2c201 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
define('PLUGIN_PATH', plugin_dir_path(__FILE__)); | |
function my_template_function($id, $size = "", $title = "", $caption = "") | |
{ | |
$template = locate_template(array('my-theme-template.php')); | |
$found_template = ($template == '') | |
? $template | |
: PLUGIN_PATH . 'templates/content/latest-comic.php'; | |
// do your Flickr goodness here | |
// $image = $this->api->getImage($id); | |
require $found_template; | |
} | |
// OR: | |
function my_template_return_content($id, $size = "", $title = "", $caption = "") | |
{ | |
$template = locate_template(array('my-theme-template.php')); | |
$found_template = ($template == '') ? $template : PLUGIN_PATH . 'templates/content/latest-comic.php'; | |
// do your Flickr goodness here | |
// $image = $this->api->getImage($id); | |
ob_start(); | |
require $found_template; | |
$found_template_content = ob_get_contents(); | |
ob_end_clean(); | |
// let plugins override the markup, and pass in the $image object | |
return apply_filters('my_return_filter', $found_template_content, $image); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment