Site logo

Archived topic

Addling a custom link to featured image on single post

3 replies · Started by Bob on June 30, 2020

Viewing posts 1–4 of 4

Hi there,

How does the template determine whether to generate a link/what the link should be?

It would determine it based on whether an image gallery exists. I can take care of that aspect, if I can get general code working to wrap the main featured image in a link when needed.

Hi there,

if you have resized the featured images ( prior to GPP 1.11 ) then try using this snippet instead:

add_filter( 'generate_single_featured_image_html', function($image_html) {
    if( $image_html == '' ) { 
        return $image_html;
    } else {
        $linked_html = '<a href="#YOUR-URL">' . $image_html . '</a>';
    }
    return $linked_html;
});
This archived topic is closed to new replies.