最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Can't make product images clickable

programmeradmin3浏览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>';

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>';
Share Improve this question asked Mar 5, 2016 at 18:54 Lukas BaranauskasLukas Baranauskas 235 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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>';
发布评论

评论列表(0)

  1. 暂无评论