WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Custom Fields
[resolved] WordPress 3.3 broke Nextgen gallery image links (16 posts)

  1. od_sf
    Member
    Posted 2 years ago #

    I have a Nextgen image gallery configured with a NGG custom "link" field so that when you click on an image in the gallery, it takes you to a different page on the site. Everything was working perfectly until i upgraded to wordpress 3.3 today. Now, when you click on an image in the gallery, it takes you to the larger version of the image located in /wp-content/gallery/ instead of the URL located in the "link" field.

    URL in question: http://www.amentimusic.com/

    Thanks,

    Olivier

    http://wordpress.org/extend/plugins/nextgen-gallery-custom-fields/

  2. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    I haven't actually tested it with WP 3.3 yet, as it more relies on NGG than WP.
    Did you also update NGG? When you update NGG, the template files you needed to edit get overwritten. You need to make the change again. If you want, you can move them to your themes directory from now on. That will stop them getting updated.
    See: http://wordpress.org/support/topic/plugin-nextgen-custom-fields-i-updated-nextgen-gallery-and-lost-all-my-custom-fields-info?replies=3

    Let me know if you have still got the changes in your template files, and I can have a look further when I get some time

  3. od_sf
    Member
    Posted 2 years ago #

    Thanks for the response shauno. Honestly don't remember if I updated NGG or not today. I might have.

    I'm really confused because in "manage gallery" all my links are still showing up (see link for screenshot below) so i don't know what changes i need to make again.

    Any additional help greatly appreciated.

    http://www.amentimusic.com/test/wp.jpg

  4. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    The links will be there. It's the template that shows the images (and outputs the <a> links that will have been overwritten.

    Here is the original thread where the concept was introduced and discussed: http://wordpress.org/support/topic/plugin-nextgen-gallery-is-it-possible-to-specify-url-links-in-thumbnails?replies=45

  5. od_sf
    Member
    Posted 2 years ago #

    shauno,

    again, thanks for the help. I think we're almost there....

    I edited gallery.php as indicted and replaced

    imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

    with

    ngg_custom_fields["releases"]; ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

    (i called my custom field releases.)

    It still however won't link to the URLs entered in the custom links fields, it just links right back to the default page.

    http://www.amentimusic.com/

    I might have taken a stupid pill this morning, so any additional help would be much appreciated. I'm sure it's something super-simple but my brain isn't working well today. :-)

  6. od_sf
    Member
    Posted 2 years ago #

    Sorry,

    re-posting, I edited gallery.php as indicted and replaced

    <a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

    with

    <a href="<?php echo $image->ngg_custom_fields["releases"]; ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >

  7. od_sf
    Member
    Posted 2 years ago #

    Never mind, fixed. again, my brain isnt working correctly today. Thank you so much for the help and the useful plugin!

    cheers,

    od

  8. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    Glad you got it sorted. As I said earlier, you can move the NGG templates to your theme to stop them being overwritten by another update.

    [ Signature moderated. ]

  9. sock2me
    Member
    Posted 2 years ago #

    I want to post an FYI for those of you running the Mazine Theme - it's integrated differently with NGG and the hack that's been working for folks here, doesn't work with that theme. Very frustrating. Somone who knows a lot of PHP might be able to get it working but I wasn't. It turns out that Mazine is not using the gallery.php page, but on inside the admin folder in the theme called tiadmin.php.

  10. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    Hey sock2me

    If you can get the image ID, you can still get the custom field value by calling <?php echo nggcf_get_field($pid, "Custom Field Name Here"); ?>.

    Hope that helps!

    [ Signature moderated. ]

  11. sock2me
    Member
    Posted 2 years ago #

    Shauno - I believe I've found the place where I'd need to make the modification - but I'm not sure what exactly I'd need to do. Can you assist? The code is below:

    foreach($gal as $item){
    $elid++;
    picture = nggdb::find_image($item->pid);
    $html .= '
    <li class="'.implode(' ', wp_get_object_terms($item->pid, 'ngg_tag', 'fields=names')).'" data-id="'.$elid.'">

    <div class="ic_container">alttext)).'" rel="group" href="'.$picture->imageURL.'"><img src="'.$picture->thumbURL.'" alt="Hello World" />
    <div class="ic_caption">
    <h3>'.stripslashes(nggGallery::i18n($item->alttext)).'</h3>
    <p class="ic_text">'.$item->description.'</p>
    </div>
    </div>';

    Thank you

  12. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    That code has come through a little broken. Please paste it in code tags (backticks)

  13. sock2me
    Member
    Posted 2 years ago #

    Thank you Shauno,
    [Code moderated as per the Forum Rules. Please use the pastebin]

    http://pastebin.com/jyeqYCJs

    I've also put it here in case this didn't come through properly. Thanks again!

  14. shauno
    Member
    Plugin Author

    Posted 2 years ago #

    You need to add the call to nggcf_get_field().

    [Code moderated as per the Forum Rules. Please use the pastebin]

    http://pastebin.com/2QWSgGqY

    Replace YOUR CUSTOM FIELD NAME HERE with the name of your custom field.

    [link removed]

  15. sock2me
    Member
    Posted 2 years ago #

    Just in case someone else ever uses Mazine theme with this plugin, here's how I solved it: (with a lot of help from shauno!)

    <li class="'.implode(' ', wp_get_object_terms($item->pid, 'ngg_tag', 'fields=names')).'" data-id="'.$elid.'">
    							<div class="gallery_series"><a title="'.stripslashes(nggGallery::i18n($item->alttext)).'" rel="group" href="'.nggcf_get_field($item->pid, 'custom link').'"><img src="'.$picture->thumbURL.'" alt="Hello World"/></a></div></li>';

    The custom field guy has to go into the href as above (my field name is 'custom link'). If you simply put that guy in a paragraph tag like shauno's sample it just shows up below the image. I also had to replace the class that was connected to the javascript file running the effect - I replaced it with 'gallery_series' and gave it the styles it needed for my layout.

    Hope this helps someone someday. Thanks again Shauno!

  16. everitt26
    Member
    Posted 2 years ago #

    Shauno! First, great plugin! I have custom links and photo titles on some of my nextgen photos and it works great. When you click the photo it takes you to the linked url etc.

    However, it has prevented my other photos from being able to enlarge or do anything but sit there as thumbnails. When you clicks the thumbnails they just refresh the page. Is tehre a hack that lets the custom fields only work on the galleries they're assigned to and not make any ther difference to the rest of the photos?

    Thanks!!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic