• Resolved Rethink

    (@rethink)


    I’m using the free version of the plugin on the most recent version of WordPress. I’d like to link the images in each menu to a larger version of the image, uncropped. I have it linked to the larger version of the plugin thumbnail, but this is cropped square. I would like to link to the original image instead. Any ideas?

    Also, is there any way to have that linked image open in a lightbox?

    Great plugin–I’m using it for a simple display of gallery images (don’t want anything as complicated as a store). http://www.gaybruntmillerdesigns.com/gallery/

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @rethink,

    It looks like you’ve already found and used the templating system. You can use the_post_thumbnail_url() to retrieve the URL to any image size. In the menu item templates, that would look like this:

    
    <a href="<?php the_post_thumbnail_url( $this->id, 'full' ); ?>">
      <img class="fdm-item-image" src="<?php echo esc_attr( $this->image ); ?>" title="<?php echo esc_attr( $this->title ); ?>" alt="<?php echo esc_attr( $this->title ); ?>">
    </a>
    
    Thread Starter Rethink

    (@rethink)

    Thanks!

    I put this code in exactly as it is here and it’s now linking to the gallery page instead of the image. Ideas?

    http://www.gaybruntmillerdesigns.com/gallery/

    Hi @rethink,

    When I inspect the href attribute of those links, it looks like it’s empty. So no URL is getting spit out. We’ll need to debug why that’s happening.

    Try adding the following to the template and then let me know the outcome for the different pictures:

    
    <?php echo 'This Menu Item ID: ' . $this->id; ?>
    
    Thread Starter Rethink

    (@rethink)

    That code is outputting the unique IDs, so that seems to be working. I tried a couple variants of the thumb call with no difference. I’m stumped.

    For now I need to put it back to normal so that the client can take a look, but I’m open to messing with it at night….

    Huh, that’s weird. I can only think either there’s some code (another plugin or theme) that’s hijacking the return value for post thumbnails or there’s an issue with the image size full.

    When you’ve got a minute to mess with it, I would try deactivating all other plugins and switching to a default theme. If it works, you can reactivate them one-by-one until you find the culprit.

    If that doesn’t identify the issue, try using a different image size (like thumbnail) or even try to see if you can get any other function to return the correct value, like get_the_post_thumbnail().

    Thread Starter Rethink

    (@rethink)

    Tried all of the above and it still didn’t work. Thanks for trying!

    The work-around for my site seems to be to regenerate thumbnails for a landscape image, knowing most of my images are landscape, and then replace those that aren’t with images that work.

    If anyone comes up with another solution in the meantime, I’d love to hear it!

    Hmm, I’m totally baffled @rethink. Not sure why those functions wouldn’t be working. I’m glad you were able to find a workaround.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Image link to full-size image’ is closed to new replies.