Skip to content

Instantly share code, notes, and snippets.

@jesgs
Created June 6, 2013 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesgs/e08e9a7b1308faf2c201 to your computer and use it in GitHub Desktop.
Save jesgs/e08e9a7b1308faf2c201 to your computer and use it in GitHub Desktop.
<?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