![](/img/trans.png)
[英]Wordpress shortcodes only working in posts, not pages. Custom theme
[英]WordPress shortcodes not working in posts
我使用短代码制作自定义主题。 主题已经准备好了,但是现在我需要输入简码。
问题是这些短代码在我的帖子中不起作用,它们仅在我的页面上可见。 当我在帖子中添加简码时,该帖子不显示任何内容。
这是简码:
function rss_subscribe_link() {
return 'Enjoy what you\'re reading? <a href="http://www.matthewbarby.com/feed/">Subscribe to our RSS feed here now</a>.'; }
add_shortcode('rss-subscribe', 'rss_subscribe_link');
add_filter('widget_text', 'do_shortcode');
有谁知道如何解决这个问题?
问候,
乔仁
如果您的帖子内容是通过get_the_content()
显示的,则可能会发生这种情况,该函数可以返回内容而无需应用默认的过滤器(wpautop,do_shortcode等),这些默认过滤器通常在您使用the_content()
。 您能确认是否是这种情况吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.