0

I've tried many things and many solutions but i can't make product images clickable. Here's the code:

if ( has_post_thumbnail() ) {
    $images .= get_the_post_thumbnail( $post->ID, 'shop_catalog' );
} 

If i make the code look like this, it doesn't show images:

return '<a href="' . get_permalink( $post->ID ) . '">' .  get_the_post_thumbnail( $post->ID, 'shop_catalog' ) . '</a>';
| improve this question | | | | |
0

try this..

$images .= '<a href="' . get_permalink( $post->ID ) . '">';
if ( has_post_thumbnail() ) {
    $images .= get_the_post_thumbnail( $post->ID, 'shop_catalog' );
}
$images .= '</a>';
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.