PHPファイルをショートコードで読み込む

ショートコードを使用してPHPの外部ファイルを呼び出す

functions.phpに。

function 関数名($params = array()) {
    extract(shortcode_atts(array(
        'file' => 'default'
    ), $params));
    ob_start();
    include(get_theme_root() . '/' . get_stylesheet() . "/$file.php");
    return ob_get_clean();
}
add_shortcode('ショートコードの名前', '関数名');

※ 親テーマの場合は.get_template()

 [ショートコード名 file="ファイル名(拡張子いらない)"]