NextGen Gallery and Custom Fields – where to enter code?
-
Hi,
I have created 2 custom fields and I want them to be displayed for every single picture – not for the thumbnails.
What code do I have to enter and where?
I tried it in the nextgen-gallery/view/singlepic.php but it did not work.Many thanks in advance,
Christinehttp://wordpress.org/extend/plugins/nextgen-gallery-custom-fields/
-
Hi biontine
If you have the ‘The gallery will open the ImageBrowser instead the effect.’ option set, then you need to add the code to the ‘imagebrowser.php’ template.
If you are talking about the popups, then you can output the custom fields as part of the ‘title’ attribute for each image, and that should show the custom field as part of the caption.Hi Shauno,
I am talking about the popup version.So I have to change the nextgen-gallery/view/singlepic.php in the following lines?
And where do I put this <?php echo $image->ngg_custom_fields[“Your Field Name Here”]; ?> ?
I tried several thing but it didn’t work.
Please add code in-between the code code tags provided by the editor, or else markup loses its formatting.
Ok, this is the original code of my singlepic.php
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?><?php if (!empty ($image)) : ?> <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->linktitle ?>" <?php echo $image->thumbcode ?> > <img class="<?php echo $image->classname ?>" src="<?php echo $image->thumbnailURL ?>" alt="<?php echo $image->alttext ?>" title="<?php echo $image->alttext ?>" /> </a> <?php if (!empty ($image->caption)) : ?><span><?php echo $image->caption ?></span><?php endif; ?> <?php endif; ?>
And where do I have to enter the
<?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?>
?The singlepic.php is not used if you are using the popups. You need to add it to the
title
attribute of the<a>
tag wrapping the images in the gallery.php file.So change the open
<a>
to this:<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?> | <?php echo $image->ngg_custom_fields["Your Field Name Here"]; ?>" <?php echo $image->thumbcode ?> >
That is adding a literally “|” character after the caption, and adding the text from the custom field
You made my day π
Glad to help
If you feel like it, you can review the plugin here, or even help the development by buying me a beer. And trust me, my programming requires lots of beer πI used your “buying me a beer” link π
And in turn, now you’ve made my day π
Hey i also need help from u regarding…..
I hav activated custom field and did as per http://www.kimwoodbridge.com/how-to-link-nextgen-gallery-images-to-an-individual-page-or-post-in-wordpress/
But not able to go to another page url. Can u please tel me. Or tell me another plugin for showing thumbnails and if we click on that will link to another page/post
If you follow the instructions in the article you linked to, you can make the thumbnail link anywhere you want.
What specifically is the problem?Hi
I successfully added the custom field under the thumbnail using nextGen custom field plugin, but my problem is that i need to make the custom field text a link to some other site, is that possible? can you help me with this? pleaseThanks a lot
All the custom fields plugin does is allow you to easily capture data against NGG images, and the get that data in the templates.
Just wrap the custom link in an
<a>
tag if you want it to be a link.I’m jumping in here because I think I am in the same boat. I have Custom Fields installed and activated. I have created a field called Links that attach to each image so that I can redirect each image to their corresponding page. That’s as far as I can manage to get. I see here that I should amend the
<a>
tag in the imagebrowser.php file but there is no imagefile.php. All my files for NextGen are nextgen-gallery/nggallery.php
nextgen-gallery/pope/README.txt
nextgen-gallery/license.txt
nextgen-gallery/wordpress_helpers.php
nextgen-gallery/changelog.txt
nextgen-gallery/non_pope/class.nextgen_settings.php
nextgen-gallery/non_pope/class.photocrati_installer.php
nextgen-gallery/non_pope/class.photocrati_settings_manager.php
nextgen-gallery/non_pope/class.photocrati_cache.php
nextgen-gallery/index.html
nextgen-gallery/readme.txtTo be as clear as I can When I go here: http://www.gablesandgates.com/agents/ there is a series of single image galleries, one gallery per realtor. When I click on Susie Lash it should take me here: http://realestate.gablesandgates.com/idx/10314/bio.php?id=1
Each agent’s image should link to their individual listing page.
Thanks a lot for your help.
Hi bc42
Since NGG have updated to version 2, the documentation on where the gallery templates are is wrong. I haven’t been able to update the docs yet.
The new place the default gallery template is here:/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php
, but that’s for the “NextGEN Gallery Basic Thumbnails”, and NO “display template” selected.
If you specify exactly what settings you have when adding the gallery to the page, I can tell you which template to alter
- The topic ‘NextGen Gallery and Custom Fields – where to enter code?’ is closed to new replies.