Plugin Author
shauno
(@shauno)
Hi samadilyas
If you have custom fields working already, all you need to do is add another, and wrap it in an anchor tag.
eg:
<a href="<?php echo $image->ngg_custom_fields["Your Link URL Field"]; ?>"><?php echo $image->ngg_custom_fields["Your Link Text Field"]; ?></a>
You can add markup around it to style with CSS, or just wrap it in <strong>
tags, to make it bold for example.
I hope that helps.
Hi shauno,
thanks for writing this plugin.
I used it with NextGen Gallery and would like to add a custom link to images that are showing in a slideshow so that when you click the image, you are taken to the link.
I already added a field called ‘custom-link’, but am not sure how to pull it in to my theme.
I am also using NextGen Galleryview.
Here is the website: http://www.gogarty.ie
How can I go about this?
thanks a bunch!
Plugin Author
shauno
(@shauno)
Hi Morgan
Adding custom fields to the JS slideshow is very difficult. The slideshow generates all it’s own markup with javascript, so it would mean changing a few of the core NGG included files. This means even if you could make the change, the next time you updated NGG, your changes would get lost.
Sorry I can’t help more with this 🙁
wow, thanks for the speedy response!
I’m looking at this right now to see if I can solve the problem: http://wordpress.org/support/topic/plugin-jj-nextgen-jquery-carousel-adding-image-link-to-thumbnails
I’ll report back if I get it working!
Plugin Author
shauno
(@shauno)
I haven’t seen JJ NExtGEN jQuery Carousel plugin yet, but if it wraps images in <a>
tags, then it should be simple to change.
I will try make some time to download it and test, and let you know what I find.
Plugin Author
shauno
(@shauno)
So I downloaded the JJ Carousel, and you can easily add custom fields as links to the slideshow. You do need to edit one of the plugin’s files, so if it updates, your change will be lost (although I see the plugin hasn’t been updated in years, so you should be good).
You said you custom field was called ‘custom-link’, so simply change line 210 of /wp-content/plugins/jj-nextgen-jquery-carousel/includes/jj_ngg_jquery_carousel.php
to this:
$output .= "<a href='".nggcf_get_field($image->pid, 'custom-link')."'>";
$output .= "<img src=\"" . $image->imageURL . "\" " . $image_description . $width_d . $height_d . " border=\"0\" />";
$output .= "</a>";
That should do it for you.
Hey thanks for looking shauno. Unfortunately, that did not work:(
Also, when I went in to fix the code (in my updated version of the plugin) I had to find a file called: jj_ngg_jquery_cycle
*not* jj_ngg_jquery_carousel
Also, the line in question was found at line 169
I might try another plugin at this point:/
Thanks for your help though! I’ll post back when I find a good work around.
Plugin Author
shauno
(@shauno)
Then you aren’t using the JJ NextGEN jQuery Carousel plugin, because the file I edited definitely is named as I said, and the change definitely works.
Good luck finding another plugin and solution.