0

I'm trying to make a product page template, editable by client, which will have 3 different NextGen Galleries per page.

In the product page admin area, I want the client to be able to select which 3 NextGen galleries to display, and in which order.

What do I put in my template page, and (I'm assuming) functions.php?

Here's a mockup of an individual product page how I want it to be, so you can see what I mean: https://dl.dropbox.com/u/10452828/LRG/a-project-page-mockup.jpg

I'm customising a theme, in which all the 'About the Product' fields etc are in the page template already, I just want to add selectable NextGen Galleries.

I've tried googling this but I'm not sure of exactly what terminology I should be searching for, so any advice would be appreciated. Thankyou!

1
  • Just to clarify, I want it to be an actual part of the page template itself, with an input box for each gallery number (or similar controlled interface), not just shortcodes they would use in the content.
    – Aaron
    Commented Jan 15, 2013 at 21:49

1 Answer 1

0

You can add galleries directly to a template by calling do_shortcode() to run the gallery shortcode.

<?php echo do_shortcode('[nggallery id="1" template="example"]'); ?>

Edit: sorry, writing decaffeinated so short attention span :)

Add some custom fields to your product pages to let your client pick which gallery goes on that product. If you like, just use the Advanced Custom Fields plugin and its friend the NextGEN Gallery Field add-on, which will let you add drop-down lists of gallery names to your edit pages.

Then in the template, get the value of each custom field and load the gallery using the shortcode as above, like this (replace 'gallery1' with your custom field names):

<?php
$gallery = get_post_meta(get_the_ID(), 'gallery1', true);
if ($gallery) {
    echo do_shortcode("[nggallery id='$gallery' template='example']");
}
?>
8
  • Yes, thankyou. But how do I create the product page template so that it runs the client selected galleries for that particular product?
    – Aaron
    Commented Jan 15, 2013 at 21:57
  • @Aaron: please see updated answer
    – webaware
    Commented Jan 15, 2013 at 22:17
  • You, sir, are a hero. I shall try that and report back. Many thanks!
    – Aaron
    Commented Jan 15, 2013 at 22:54
  • NB: if you're going to use the Advanced Custom Field plugin and the NextGEN add-on, look at their code samples as their custom fields return more than just the gallery ID.
    – webaware
    Commented Jan 15, 2013 at 23:09
  • I'm finally getting the chance to try this tonight - just wanted you to know I hadn't abandoned this thread! Really appreciate the answer.
    – Aaron
    Commented Jan 19, 2013 at 23:00

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.