• Resolved MattAbode

    (@mattabode)


    Hi I really need help with the NextGEN custom fields.

    Basically, i’ve set up the NextGEN Custom Field plugin with a Image Custom field named “Link”

    I’ve switched off the Lightbox option as suggested in the installation documentation.
    Currently the field is showing within the gallery, however the pictures aren’t linking. When I click them it just brings up what i’m assuming is the Lightbox (despite being switched off) or the default option instead of linking to my chosen page.

    – I’m using the [Gallery id = X] short code for my thumbnail gallery on the page.
    – I’m not using a template for the thumbnail gallery

    I’ve inserted the code into the PHP file Nextgen-Gallery > Products > Photocrati_nextgen > Modules > nextgen_basic_gallery > templates > thumbnails > index.php

    My code is the following. Not sure if I have put it in the correct place or if it’s even correct. I’m hoping you could shed some light on that.

    <div class="ngg-gallery-thumbnail">
                <a href="<?php echo nggcf_get_field($image->pid, "Link"); ?>"
                   title="<?php echo esc_attr($image->description)?>"
                   data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
                   data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
                   data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
                   data-title="<?php echo esc_attr($image->alttext); ?>"
                   data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
                   <?php echo $effect_code ?>>
    
                    <img
                        title="<?php echo esc_attr($image->alttext)?>"
                        alt="<?php echo esc_attr($image->alttext)?>"
                        src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>"
                        width="<?php echo esc_attr($thumb_size['width'])?>"
                        height="<?php echo esc_attr($thumb_size['height'])?>"
                        style="max-width:none;"
    
                    />
    
                </a>
    
            </div>

    It would be much appreciated if you help me as this is last bit to add to my website. I’ve searched high and low on the internet to try and figure it out but I just give up now.

    Regards
    Matt

    https://wordpress.org/plugins/nextgen-gallery-custom-fields/

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author shauno

    (@shauno)

    Hi MattAbode
    I looks and sounds like you’ve done everything right. But NGG has a template cache, so even after making changes to the templates they sometimes don’t reflect immediately.

    Try clearing the cache. Go to ‘Gallery -> Other Options -> Miscellaneous’, and click the ‘Clear image cache’ button.

    If it’s still not working, can you post a URL to the gallery page I can see.

    Thread Starter MattAbode

    (@mattabode)

    Hi
    thanks for the reply it’s much appreciated.
    The URL for the gallery is http://abodesofas.com/gall/

    I’ve tried clearing the cache every time i’ve made changes and it makes no difference.

    Regards
    Matt

    Plugin Author shauno

    (@shauno)

    The shortcode you are using is the default WordPress gallery. You are not using NextGEN Gallery, which the voting plugin is built for.

    Thread Starter MattAbode

    (@mattabode)

    Ok, but when I use the NextGEN gallery, there is no text hover like when I use the default WordPress Gallery, is there anyway I can use that in the NextGEN as that is what I’m after on the images.

    Also the tags don’t appear on the right hand side to move the images around once they are clicked.

    Thanks for the reply!

    Regards
    Matt

    Plugin Author shauno

    (@shauno)

    You can maybe use the NExtGEN caption template. But if you do, be sure to add the custom field to the correct template file. You can see which template gets used here: http://shauno.co.za/nextgen-gallery-v2-display-template-locations/

    Thread Starter MattAbode

    (@mattabode)

    Hi,
    I’ve tried using the caption template but it just shows up like this http://abodesofas.com/gall/

    Basically I just want it with the hover text and for the gallery tags to appear at the side like it did when I used the default wordpress gallery.

    Regards
    Matt

    Plugin Author shauno

    (@shauno)

    If you want the hover text in NextGEN, you are going to have to code it yourself, or hire a developer to code it.

    ManZim

    (@manzim)

    Hi!

    I have the same problem. I see the field but it doesn’t work.

    1. Try clearing the cache. Go to ‘Gallery -> Other Options -> Miscellaneous’, and click the ‘Clear image cache’ button.
    #done

    Best regards

    Manfred

    ManZim

    (@manzim)

    …and I insert the code in the for … loop.

    arrisje

    (@arrisje)

    Yes finally I was able to update to the new one.

    This is how I did it:

    I downloaded nextgen Gallery. Opened the zip file found the index file in: /nextgen-gallery/products/photocrati_nextgen/modules/nextgen_basic_gallery/templates/thumbnails/index.php

    Located

    <div class="ngg-gallery-thumbnail">
                <a href="<?php echo esc_attr($storage->get_image_url($image, 'full', TRUE))?>"
                   title="<?php echo esc_attr($image->description)?>"
                   data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
                   data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
                   data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
                   data-title="<?php echo esc_attr($image->alttext); ?>"
                   data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
                   <?php echo $effect_code ?>>
                    <img
                        title="<?php echo esc_attr($image->alttext)?>"
                        alt="<?php echo esc_attr($image->alttext)?>"
                        src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>"
                        width="<?php echo esc_attr($thumb_size['width'])?>"
                        height="<?php echo esc_attr($thumb_size['height'])?>"
                        style="max-width:none;"
                    />
                </a>
            </div>

    Replaced with:

    <div class="ngg-gallery-thumbnail">
                <a href="<?php echo nggcf_get_field($image->pid, "Link"); ?>"
                   title="<?php echo esc_attr($image->description)?>"
                   data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
                   data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
                   data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
                   data-title="<?php echo esc_attr($image->alttext); ?>"
                   data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
                   <?php echo $effect_code ?>>
    
                    <img
                        title="<?php echo esc_attr($image->alttext)?>"
                        alt="<?php echo esc_attr($image->alttext)?>"
                        src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>"
                        width="<?php echo esc_attr($thumb_size['width'])?>"
                        height="<?php echo esc_attr($thumb_size['height'])?>"
                        style="max-width:none;"
    
                    />
    
                </a>
    
            </div>

    Went to ‘Gallery -> Other Options -> Miscellaneous’, and click the ‘Clear image cache’ button.

    And it works. THANK YOU !

    here is my site for your info http://arrisje.com

    arrisje

    (@arrisje)

    Well it was working but with this change I was not able to login into my account the login button had vanished, so I went back to the old version 🙁 of next gen gallery and custom fields

    Does anyone where to add the target attribute in the above code so the “Link” opens in a new window?
    <?php

    $this->start_element(‘nextgen_gallery.gallery_container’, ‘container’, $displayed_gallery);

    ?>
    <div
    class=”ngg-galleryoverview<?php if (!intval($ajax_pagination)) echo ‘ ngg-ajax-pagination-none’; ?>”
    id=”ngg-gallery-<?php echo_h($displayed_gallery_id)?>-<?php echo_h($current_page)?>”>

    <?php if (!empty($slideshow_link)): ?>
    <div class=”slideshowlink”>
    ‘><?php echo $slideshow_link_text ?>

    </div>
    <?php endif ?>

    <?php if ($show_piclens_link): ?>
    <!– Piclense link –>
    <div class=”piclenselink”>
    “>
    <?php echo_h($piclens_link_text); ?>

    </div>
    <?php endif ?>
    <?php

    $this->start_element(‘nextgen_gallery.image_list_container’, ‘container’, $images);

    ?>
    <!– Thumbnails –>
    <?php for ($i=0; $i<count($images); $i++):
    $image = $images[$i];
    $thumb_size = $storage->get_image_dimensions($image, $thumbnail_size_name);
    $style = isset($image->style) ? $image->style : null;

    if (isset($image->hidden) && $image->hidden) {
    $style = ‘style=”display: none;”‘;
    }
    else {
    $style = null;
    }

    $this->start_element(‘nextgen_gallery.image_panel’, ‘item’, $image);

    ?>
    <div id=”<?php echo_h(‘ngg-image-‘ . $i) ?>” class=”ngg-gallery-thumbnail-box” <?php if ($style) echo $style; ?>>
    <?php

    $this->start_element(‘nextgen_gallery.image’, ‘item’, $image);

    ?>
    <div class=”ngg-gallery-thumbnail”>
    pid, “Link”); ?>”
    title=”<?php echo esc_attr($image->description)?>”
    data-src=”<?php echo esc_attr($storage->get_image_url($image)); ?>”
    data-thumbnail=”<?php echo esc_attr($storage->get_image_url($image, ‘thumb’)); ?>”
    data-image-id=”<?php echo esc_attr($image->{$image->id_field}); ?>”
    data-title=”<?php echo esc_attr($image->alttext); ?>”
    data-description=”<?php echo esc_attr(stripslashes($image->description)); ?>”
    <?php echo $effect_code ?>>
    <img
    title=”<?php echo esc_attr($image->alttext)?>”
    alt=”<?php echo esc_attr($image->alttext)?>”
    src=”<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>”
    width=”<?php echo esc_attr($thumb_size[‘width’])?>”
    height=”<?php echo esc_attr($thumb_size[‘height’])?>”
    style=”max-width:none;”
    />

    </div>
    <?php

    $this->end_element();

    ?>
    </div>
    <?php

    $this->end_element();

    ?>

    <?php if ($number_of_columns > 0 && empty($show_all_in_lightbox)): ?>
    <?php if ((($i + 1) % $number_of_columns) == 0 ): ?>
    <br style=”clear: both” />
    <?php endif; ?>
    <?php endif; ?>

    <?php endfor ?>
    <?php

    $this->end_element();

    ?>

    <?php if ($pagination): ?>
    <!– Pagination –>
    <?php echo $pagination ?>
    <?php else: ?>
    <div class=”ngg-clear”></div>
    <?php endif ?>
    </div>
    <?php $this->end_element(); ?>`

    Agg!!! Sorry for the mess!

    Does anyone where to add the target attribute in the above code so the “Link” opens in a new window?

    <div class="ngg-gallery-thumbnail">
                <a href="<?php echo nggcf_get_field($image->pid, "Link"); ?>"
                   title="<?php echo esc_attr($image->description)?>"
                   data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
                   data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
                   data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
                   data-title="<?php echo esc_attr($image->alttext); ?>"
                   data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
                   <?php echo $effect_code ?>>
    
                    <img
                        title="<?php echo esc_attr($image->alttext)?>"
                        alt="<?php echo esc_attr($image->alttext)?>"
                        src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>"
                        width="<?php echo esc_attr($thumb_size['width'])?>"
                        height="<?php echo esc_attr($thumb_size['height'])?>"
                        style="max-width:none;"
    
                    />
    
                </a>
    
            </div>

    [RESOLVED]

    NextGen Gallery thumbnail image link in new window when using NextGen Custom Fields plugin. Place target=”_blank’ in the following location:

    <div class="ngg-gallery-thumbnail">
                <a target="_blank" href="<?php echo nggcf_get_field($image->pid, "Link"); ?>"
                   title="<?php echo esc_attr($image->description)?>"
                   data-src="<?php echo esc_attr($storage->get_image_url($image)); ?>"
                   data-thumbnail="<?php echo esc_attr($storage->get_image_url($image, 'thumb')); ?>"
                   data-image-id="<?php echo esc_attr($image->{$image->id_field}); ?>"
                   data-title="<?php echo esc_attr($image->alttext); ?>"
                   data-description="<?php echo esc_attr(stripslashes($image->description)); ?>"
                   <?php echo $effect_code ?>>
                    <img
                        title="<?php echo esc_attr($image->alttext)?>"
                        alt="<?php echo esc_attr($image->alttext)?>"
                        src="<?php echo esc_attr($storage->get_image_url($image, $thumbnail_size_name, TRUE))?>"
                        width="<?php echo esc_attr($thumb_size['width'])?>"
                        height="<?php echo esc_attr($thumb_size['height'])?>"
                        style="max-width:none;"
                    />
                </a>
            </div>
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Custom Fields Not Working. Not Linking’ is closed to new replies.