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>
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; ?>
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().
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.