以下是从wordpress页面中提取内容所需的代码。您需要页面的id号,并将其添加到短代码中。[示例page\\u id=“21”][/示例]
function example_shortcode( $atts, $content = null) {
extract( shortcode_atts( array(
\'page_id\' => \'\'
), $atts
)
);
// Will display our page content of the shortcode need a number of the page id
$post = get_post($page_id);
$content = apply_filters(\'the_content\', $post->post_content);
echo $content;
}
add_shortcode(\'example\', \'example_shortcode\');
//[example page_id="page id number here"][/example]