Posted on 14 December, 2009 By Kim Woodbridge 14 Comments

NextGEN Custom Fields Plugin: Add More Information about an Image in the NextGEN Gallery

Vermont Field (by bengarland)

If you’ve ever wanted to add additional information about the images in your NextGEN Gallery, you can do so with the NextGen Custom Fields Plugin.

This plugin will add additional fields that you define to each image in the gallery.

The downside of this plugin, is that you have to be comfortable editing the template files. To actually display the data in your new custom field, you need to edit one or two of the templates that are included with the NextGEN Gallery plugin.

And the plugin takes a little bit of extra work to install and activate – it’s not quite as easy as most plugins. But if you want to add additional information in your image gallery, it is worth the extra work.

Note: You must already have NextGEN Gallery installed and Galleries within NextGEN.

Installation

  1. Upload the plugin to your plugins directory and activate.
  2. Put the following URL in the address bar in your web browser. http://www.example.com/wp-admin/admin.php?page=nextgen-gallery-custom-fields/ngg-custom-fields.php&mode=upgrade Make sure you change www.example.com to your own domain name. This seems to be a 2nd level of activation for the plugin.
  3. You will now have a NGG Custom Fields menu in the left navigation in the WordPress Admin.
    nggmenu
  4. Click on Setup Fields
  5. You can choose to create a custom field for individual images or for an entire gallery. I am going to continue with creating them for images.
    nggsetup
  6. Give the custom field a name, tell which galleries it should be associated with, select the type of field and then click on the Create Field button.
    nggfields
  7. Now that you have created a new custom field, you will want to add data to it. Go to Gallery > Manage Gallery and select a Gallery that you associated a custom field with.
  8. In the Gallery you will see a new blank field, which is the field that you just created. In mine I have a new field called Link and it is a URL on my site that I want to be associated with the image.
    gallery
  9. Fill in the data that you want associated with the image.

Ok, great. Now what?

You’ve created a new custom field for your Next Gen images and filled the field in with data. But now what do you do? How do you get this field to show up?

Well, you have to edit one or two of the NextGen plugin files: nextgen-gallery/view/gallery.php and nextgen-gallery/view/gallery-caption.php The first one must be edited but if you are using captions with the images, the second one must be edited as well.

  1. For images, add the following code to the template file(s) mentioned above:
    <?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?>
    
  2. “Your Field Name Here” is what you named the custom field. For example, I named mine Link.
  3. For Galleries, add the following code to the template file(s) mentioned above:
    <?php echo nggcf_get_gallery_field($gallery->ID, "My Gallery Field
    Name Here"); ?>
    
  4. “My Gallery Field Name Here” is what you named the custom field for the gallery.

Now you can’t add the code to just any old spot within the template. I used mine to link each image and image description on my portfolio page to a specific WordPress page on my site.

In my next article, I will show where I placed the code and how this NextGen Custom Fields can be used to link to specific posts or pages on your own site or other locations on the Internet.

photo credit: bengarland


Related Posts:
  • Using WordPress Custom Fields to Display NextGen Gallery Slideshows Conditionally
  • How to Link NextGEN Gallery Images to an Individual Page or Post in WordPress
  • How to Create Your Own WordPress Shortcode
  • WordPress: Missed Schedule for Scheduled Posts – A Plugin Fix
  • How to Link to Your Facebook Fan Page from Your Profile Page
  • Posted In : WordPress Plugins | WordPress Tips
    If you enjoyed this post, please subscribe to my RSS Feed

    Post to Twitter   Post to Delicious   Post to StumbleUpon

    14 Responses to “NextGEN Custom Fields Plugin: Add More Information about an Image in the NextGEN Gallery”

    Trackbacks/Pingbacks
    1. How to Link NextGEN Gallery Images to an Individual Page or Post in WordPress | (Anti) Social Development
    Leave a Comment
    You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .


    Recent Comments

      • Kim Woodbridge: It seems that a business profile can be converted into a personal one. http://www.facebook.com/help/?faq=12843 I hav...
      • Angie: THANK YOU THANK YOU THANK YOU!!!!!!!!!!!!!! This was DRIVING me CRAZY!...
      • Kim Woodbridge: Hi Patricia - Overall things still aren't great for women. In some places, like the Congo, it's horrific and I feel for...
      • Kim Woodbridge: Hi Vered - Thanks!...
      • Kim Woodbridge: Hi Dot - The incidence and lack of punishment is appalling. Possession of marijuana is considered to be an offense that...
      • Kim Woodbridge: Hi Ajith - I hope that passes. Since women usually make 50% or more of a population they should have more political re...
      • Kim Woodbridge: Hi Patricia - I like Mark Ruffalo a lot - he seems really likable, friendly, and offbeat. Glad you like the links :-)...
      • Patricia: Well done and important information to share. How lucky are we? I think sometimes we are just in a different zone our ...