首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将the_content放置在不工作的短代码中

将the_content放置在不工作的短代码中
EN

WordPress Development用户
提问于 2016-09-01 15:20:15
回答 1查看 995关注 0票数 1

已将<?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(); ?>时也会出现内容

我做错了什么?

EN

回答 1

WordPress Development用户

回答已采纳

发布于 2016-09-01 15:44:36

似乎不存在变量$the_content。我猜您想要的是函数the_content(),但由于它实际上与其输出相呼应,所以也不能工作。您需要使用函数get_the_content(),它将返回输出(而不是回显它)。

试试这个:

代码语言:javascript
复制
echo do_shortcode('[wcm_restrict plans="silver"]' . get_the_content() . '[/wcm_restrict]');
票数 5
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/237896

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档