开发者 |
shauno
firsh |
---|---|
更新时间 | 2024年1月20日 02:50 |
PHP版本: | 2.7.1 及以上 |
WordPress版本: | 6.4 |
wp-content/plugins/
directoryHave 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.
After activation the plugin, there will be a new main menu item in the WordPress dashboard, labeled "NGG Custom Fields". If you open this menu item, you will be able to add "Gallery Custom Fields", or "Image Custom Fields". "Gallery Custom Fields" are used to add information about the gallery as a whole, while Image "Custom Fields" are used for adding information about each individual image. When you add a custom field from this screen, you select which of your NGG galleries it is linked to.
So once you’ve created custom fields linked to your galleries, and inputted the values in NGG’s Manage Gallery screen, you’ll want to display these fields in your galleries on your site.
<?php echo nggcf_get_field($image->pid, "Your Image Field Name"); ?>
<?php echo nggcf_get_gallery_field($gallery->ID, "Your Gallery Field Name"); ?>
/plugins/nextgen-gallery/view/
directory. For the default shortcode, [nggallery id=x]
, you
add the tag to the gallery.php
file. If you add the template
attribute to your shortcode, you need to alter the appropriate template. eg:
If you use the [nggallery id=x template="caption"]
, you need to add the tag to the gallery-caption.php
template.
For NGG version 2.x, you need to add the tag to the /nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php
template. This will only work for galleries inserted WITHOUT selecting a template from the gallery display options.
NGG v2.x templating system can be confusing for some users. Please see this page for more info on which templates are used under different settings.
Please be aware, for “Image Custom Fields", the tag needs to be placed inside the foreach()
loop in the template, as that loop is outputting each image.
For “Gallery Custom Fields", be sure to place the tag outside of the foreach, or it will show for each image.
add_menu_page()
and add_submenu_page()
changing capability to 'manage_options' from deprecated user level 8 (thanks to ksemel for the report)field_value
column back to TEXT from VARCHAR(255), to allow more than 255 characters saved (thanks to ksemel for the find and bug report)