示例#1
0
function jkcomics_display_comic($atts)
{
    $a = shortcode_atts(array('id' => false, 'bar' => 'something else'), $atts);
    $output = array();
    //
    $comic = new Comic();
    if (!$a['id']) {
        $comic->getMostRecent();
    } else {
        $comic->getByPostId($a['id']);
    }
    //
    $categories = get_terms('comic_types');
    //
    $template = new Template();
    $templateResponse = $template->get(__DIR__ . '/templates/comic.php', array('comic' => $comic, 'categories' => $categories));
    $output[] = $templateResponse;
    $output = implode("\n", $output);
    return $output;
}