Wordpress - 使用自定义字段调用相关 NivoSlider
我目前希望在帖子内容区域之外的每个帖子上使用不同的 NivoSlider,因此我设置了一个自定义字段(“nivo_number”),我可以在其中输入 Nivo Slider 编号并使用
所以,目前我有:
<?php echo do_shortcode;?>("<?php echo get_post_meta($post->ID, 'nivo_number', true); ?>")<?php ; ?>
但是,这只是在网站上输出以下文本
do_shortcode("[nivoslider id='123']")
任何人都可以帮忙吗?如果没有意义,我会尝试进一步解释。
谢谢
I am currently looking to use a different NivoSlider on each post outside of the post content area, so I set up a custom field ('nivo_number') where I can enter the Nivo Slider number and call it within the template using
So, currently I have:
<?php echo do_shortcode;?>("<?php echo get_post_meta($post->ID, 'nivo_number', true); ?>")<?php ; ?>
However this just outputs the following text on the site
do_shortcode("[nivoslider id='123']")
Can anyone help? If it doesn't make sense I will try and explain futher.
Thankyou
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为第二个
echo
是不必要的,我不知道这是否是问题所在,为什么不尝试一下:或者
顺便说一句,自定义字段的值到底是什么?是
[nivoslider id='123']
还是123?刚刚注意到您的语法中有一个错误。这里
echo do_shortcode;?>(" 你要在
(
之前关闭?>
,这可能就是原因该代码不被解释。I think the second
echo
is not necessary, I don't know if that is the problem, why don't you try:or
BTW what's exactly the value of the custom field? is it
[nivoslider id='123']
or just 123?Just noticed an error in your syntax. Here
echo do_shortcode;?>("<?php echo
you're closing?>
before(
, that might be the reason the code isn't interpreted.