Creates the ability to quickly and easily add custom fields to NextGEN Galleries and Images.
Have you ever wanted to add just a little more information about a picture in your NextGEN Gallery? Maybe you wanted to add the name of the photographer? Or where the picture was taken? Well, with this plugin you can add as many extra custom fields to the images as you need, and stop you trying to squeeze all the info into the description.
Well, when it was originally developed, you could only add fields to images in a gallery. But as of version 0.4, you can add custom fields to images AND galleries!
Here is the condensed version for those of you with short attention spans. I do recommend reading the full FAQ below this if you have issues.
Install
http://www.example.com/wp-admin/admin.php?page=nextgen-gallery-custom-fields/ngg-custom-fields.php&mode=upgrade where "example.com" is your siteSetup Field
Add Data to Fields
Displaying Fields
<?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?><?php echo nggcf_get_gallery_field($gallery->ID, "My Gallery Field Name Here"); ?>Please remember, that was over simplified. Please do take the time to read the full FAQ below. If you are still having problems, post on the WordPress forums with the tag nextgen-gallery-custom-fields. I do visit the forum from time to time, and will hopefully be able to help you out
Once the plugin is activated, a new menu item will appear on the left navigation of the WordPress admin called "NGG Custom Fields". Under this option there is a "Setup Fields" option. If you click on that, you will be presented with 2 options. Since we are dealing with custom fields for images, select the "Image Custom Fields" option. You will be presented with a screen asking you for a field name, linked galleries, and field type. Enter the name of the field you want to add to and select which galleries you want it to show on (all are check by default). Then and select from either "Text Input", "Text Area" or "Drop Down". If you select "Drop Down" as the tpye, another text area will become visible allowing you to add the options you want the drop down to have. Once you have captured those fields, click on the "Create Field" button. This will save the field in the database. Now if you manage a gallery from the "Manage Gallery" option under NextGEN Gallery, you will see the field you added for each image (make sure you select a gallery that you linked to your field).
There are a couple of ways to implement your new fields in the various template. The method you should use if you are running the latest version of NGG (anything from 1.2.1), is by putting this tag where you want your field to show: <?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?>
If you are using an older version on NGG, that might not work. Then you need to use the following tag instead: <?php echo nggcf_get_field((int)IMAGEID, (string)FIELDNAME); ?>
Not a php coder are we? No problemo! You need to replace (int)IMAGEID with the id NGG has assigned the picture. For instance, in nextgen-gallery/views/gallery.php, that would be $image->pid in the foreach loop (roughly line 38 in NGG 1.2.1)
The (string)FIELDNAME is the name of the field you previously set up.
So, if you setup a field called "Awesome field", the code you would add to the gallery template would look like this: <?php echo nggcf_get_field($image->pid, 'Awesome field'); ?>
As of version 0.4, the ability to add custom fields to galleries has been added. It was a little janky until 1.1.3, where support for new NGG hooks was used making it more 'native'.
Now you can add the fields in the exact same way as for images. Just select the "Gallery Custom Fields" option from the menu and add the fields exactly as you would have for images. Once you've added your custom fields for the gallery, go to the "Manage Gallery" of NextGEN Gallery, and select a gallery. Under the "Gallery settings" section of the page, you should now see a "Custom Fields" heading, with your custom fields listed! You can now capture your values for the fields, and save the gallery.
Simply enter put the following tag where you want your field to display: <?php echo nggcf_get_gallery_field($gallery->ID, "My Gallery Field Name"); ?> obviously replacing "My Gallery Field Name" with your field name.
Make sure you add the fields you want to the correct place. Image fields added from the "Image Custom Fields" menu option and gallery fields from the "Gallery Custom Fields" option. Sounds simple, but you can overlook it.
Is the custom field linked to the correct gallery?
If you have unusual characters in your fields names, it can break the output. Stick to upper and lower case letters, and numbers to avoid any issues. As of version 0.5 there is some basic sanitation done to the names of fields and their values, but it is far from perfect. It should allow characters such as apostrophes well enough though.
Requires: 2.7.1 or higher
Compatible up to: 3.3.1
Last Updated: 2011-11-19
Downloads: 38,535




