NextGen gallery shortcode with and id from a custom field
-
Can anyone help me with this? .
I have the Next Gen slideshow shortcode working when coded into the loop… but I need help getting the shortcode to take the slideshow id=X from a custom field value.
The code just below works, but only with a hardcoded ID (of 3). The IF statement checks whether there is a value in the custom field (so if there is no slideshow with this post, then nothing is shown).
<?php if ( get_post_meta($post->ID, “slideshow”, true) ): ?>
<?php echo do_shortcode(‘[slideshow id=3]’); ?>
<?php endif; ?>
What I need is this:
<?php echo do_shortcode(‘[slideshow id=thecustomfieldvalue]’); ?>I’ve tried this:
<?php echo do_shortcode(‘[slideshow id=<?php echo get_post_meta($post->ID, “nameofyourcustomfield”, true); ?>]’); ?>
but, it returns [gallery not found]
- The topic ‘NextGen gallery shortcode with and id from a custom field’ is closed to new replies.