1

When a user creates a new post there is a meta field on the back end where they can enter the id of the nextgen gallery to display. I want to then display in their post the gallery which corresponds to the id they entered.

When I run the code below $meta echoes as #3 and the gallery shows, so I know that for this post rw_propGallery is set to 3, and that three is the id of an existing gallery.

$meta = get_post_meta(get_the_ID(), 'rw_propGallery', true);
echo $meta;
echo do_shortcode('[nggallery id=3]')

But if I switch it to

echo do_shortcode('[nggallery id=$meta]')

I get the number 3, and "Gallery not found". Any suggestions?

1 Answer 1

2

Perhaps try:

echo do_shortcode('[nggallery id=' . $meta . ']');
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.