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 anyon开发者_Go百科e help? If it doesn't make sense I will try and explain futher.
Thankyou
I think the second echo
is not necessary, I don't know if that is the problem, why don't you try:
<?php echo do_shortcode(get_post_meta($post->ID, 'nivo_number', true)); ?>
or
<?php
$nivo_number = get_post_meta($post->ID, 'nivo_number', true);
echo do_shortcode($nivo_number);
?>
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.
精彩评论