• Resolved sukafiacom

    (@sukafiacom)


    Hello, please i need help making my featured image link to post, normally when you click on the featured image its supposed to take you to the post but its not so on my site. I’ve played around with all the codes i know, read support topics but still can’t get the featured image to link to post. I’m using “Patus” free wordpress theme and the theme support forum is inactive. Please someone should kindly help out. Thanks

    Please note that I’ve tried adding;

    add_filter( ‘post_thumbnail_html’, ‘my_post_image_html’, 10, 3 );

    function my_post_image_html( $html, $post_id, $post_image_id ) {

    $html = ‘‘ . $html . ‘‘;
    return $html;

    }

    to functions.php but it ain’t working. and below is the only code in my functions.php that has to do with thumbnails:

    add_theme_support( ‘post-thumbnails’ );
    add_image_size( ‘large-thumb’, 650, 300, true );

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter sukafiacom

    (@sukafiacom)

    Try this. In the template-parts/content.php file, change this:

    echo '<div class="post-thumbnail">';
    the_post_thumbnail( 'large-thumb' );
    echo '</div>';

    To this:

    echo '<div class="post-thumbnail"><a href="' . get_permalink() . '">';
    the_post_thumbnail( 'large-thumb' );
    echo '</a>';
    echo '</div>';
    Thread Starter sukafiacom

    (@sukafiacom)

    Thanks i had also tried something similar and it didn’t work, seems like all i needed to do was clear my cache #WP super cache.

    I’m really grateful for your help. Thanks & God bless.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to link featured image to post’ is closed to new replies.