Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Perhaps try:

echo do_shortcode('[nggallery id=' . $meta . ']');
share|improve this answer
    
Thanks –  Chuck Jun 30 '11 at 2:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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