// 投稿埋込用ショートコード
// タイトルのoff、または書き換え可能
// post slug=XXX
// post slug=XXX title=off
// post slug=XXX title=タイトルをこの文字列で書き換え
function add_other_post($params = array()) {
extract(shortcode_atts(array(
'slug' => '',
'title' => ''
), $params));
$html = '';
if ($slug == '') return $html;
$queries = new WP_Query("name=$slug");
while ($queries->have_posts()) {
$queries->the_post();
if ($title == 'off') $title = '';
elseif ($title == '') $title = the_title('','',false);
if ($title !== '') $html .= '<h2>' . $title . "</h2>n";
$content = get_the_content();
$content = apply_filters('the_content', $content);
$html .= $content;
}
wp_reset_postdata();
return $html;
}
add_shortcode('post', 'add_other_post');