已将<?php echo do_shortcode('[wcm_restrict plans="silver"]' .$the_content. '[/wcm_restrict]'); ?>放入模板中,但内容未出现。
已经对<?php echo do_shortcode('[wcm_restrict plans="silver"]Big Blue[/wcm_restrict]'); ?>进行了测试,因此知道这些标记运行良好。也尝试过get_the_content
仅使用<?php the_content(); ?>时也会出现内容
我做错了什么?
发布于 2016-09-01 15:44:36
似乎不存在变量$the_content。我猜您想要的是函数the_content(),但由于它实际上与其输出相呼应,所以也不能工作。您需要使用函数get_the_content(),它将返回输出(而不是回显它)。
试试这个:
echo do_shortcode('[wcm_restrict plans="silver"]' . get_the_content() . '[/wcm_restrict]');https://wordpress.stackexchange.com/questions/237896
复制相似问题