我很确定上面的代码应该是
<?php do_shortcode(\'[subscribe]<p>This is the subscription text</p>[/subscribe]\'); ?>
然后,您可以使用shortcode函数中的内容,如下所示:
<?php
function subscribe_shortcode($atts, $content = \'\', $code = NULL) {
return \'<div id="whatever-etc">\'.$content.\'</div>\';
}
add_shortcode(\'subscribe\', \'subscribe_shortcode\');
?>
以上将输出:
<div id="whatever-etc">
<p>This is the subscription text</p>
</div>