<?php
echo do_shortcode(\'[learn_more caption="ancila"]
<p>
<?php echo get_post_meta($postid,principal_1,true)";
wp_reset_query(); ?>
</p>
[/learn_more]\');
?>
此短代码中的Php代码无效。。当这个php代码在shortcode之外给出时,它就正常工作了。。请帮帮我。。短代码中的PHP正在被注释
1 个回复
SO网友:Nicolai Grossherr
您不能在do_shortcode()
打电话就像你想打一样。如果您只是想用短代码包装您的帖子元内容,那么您可以按如下所示进行操作。
$your_post_meta_variable_content = get_post_meta( $postid, principal_1, true );
echo do_shortcode(
\'[learn_more caption="ancila"]\'
. $your_post_meta_variable_content .
\'[/learn_more]\'
);
结束