Displaying Custom Fields With NextGen Gallery Albums
-
I have a site (on my local dev server) that uses NextGen galleries. The client wants to add links on pages created for these galleries (using manage gallery > create new page) to other sites and I have added a custom field for this:
<?php $gallery_link = get_post_meta($post->ID, 'Gallery_Link', true); if ($gallery_link) { ?> <a href="<?php echo $gallery_link; ?>" target="_blank">See more images and buy prints on this website</a>. <?php } else { ?> <p><a href="contact">Contact me</a> if you are interested in buying prints.</p> <?php } ?>
This works and the client can add his URLs and they display as intended.
However, I want to use the NextGen album feature and have built a new all galleries template and added the [album id=1 template=extend] shortcode. Galleries load as expected, but I can’t get the custom fields to display on my page when viewing the individual galleries. I have tried adding various code to my template, the latest being this:
<?php // second loop for gallery urls global $wp_query; $gallery_link = $wp_query->post->ID; echo get_post_meta($gallery_link, 'Gallery_Link', true); wp_reset_query(); ?>
Sorry if this is a long explanation, but I have exhausted my own resources on this one and am frustrated by a long afternoon with no success! (I tried the NGG Custom Fields plugin but that doesn’t do it either.)
- The topic ‘Displaying Custom Fields With NextGen Gallery Albums’ is closed to new replies.