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.

Im trying to use a custom field inside a shortocde for a nextgen gallery slider on a page. The goal is to change the gallery id by entering in the corresponding id on page creation with a custom field. This doesn't seem to be working how I have it setup though and is just calling all images which makes me thing no value for the gallery id is being called.

<?php
  global $image_gallery; 
  $image_gallery = get_post_meta($post->ID, 'image_gallery', TRUE); 
?>
<?php echo do_shortcode('[jj-ngg-image-list html_id="about-image-list" gallery="return $image_gallery" max_pictures="4" width="160" height="150" orientation="horizontal"]'); ?>
<?php ?>
share|improve this question
add comment

1 Answer

you pass the variable using normal php string concatenation:

<?php echo do_shortcode('[jj-ngg-image-list html_id="about-image-list" gallery="' . $image_gallery . '" max_pictures="4" width="160" height="150" orientation="horizontal"]'); ?>
share|improve this answer
    
ohhhh I knew I was missin something..thanks! –  Pollux Khafra Feb 4 '12 at 3:24
1  
please mark the answer so others can find solutions for similars problems –  andresmijares25 Feb 4 '12 at 7:47
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.