no-image

投稿内でget_template_partするショートコード

[get_template_part name=“hogehoge”]

function wp_gtp($atts) {
$shortcode_output = NULL;

extract(shortcode_atts(array(
'name' => '',
), $atts));

ob_start();
get_template_part($name);
$temp = ob_get_contents();
ob_end_clean();

$shortcode_output .= $temp;

return $shortcode_output;
}
add_shortcode('get_template_part', 'wp_gtp’);
pocketlinehatebuimagegalleryaudiovideocategorytagchatquotegoogleplusfacebookinstagramtwitterrsssearchenvelopeheartstaruserclosesearch-plushomeclockupdateeditshare-squarechevron-leftchevron-rightleafexclamation-trianglecalendarcommentthumb-tacklinknaviconasideangle-double-upangle-double-downangle-upangle-downstar-halfstatus