make product images link
-
hello, i’m using this theme with Woocommerce, but the product images aren’t clickable.i want to make the product images link to the product.
-
i was using this before and it worked, but since this new update it breaks my website making it giving an error 500.
function wpb_autolink_featured_images( $html, $post_id, $post_image_id ) { If (! is_singular()) { $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . $html . '</a>'; return $html; } else { return $html; } } add_filter( 'post_thumbnail_html', 'wpb_autolink_featured_images', 10, 3 ); ?>
Hi @roseeds,
thanks for your suggestion.I just released a new update of SuevaFree (3.6.2) with this feature, please install the new version when will be available (within few hours)
You’ll able to enable this feature going to
Customize ▸ SuevaFree Main Settings ▸ Settings ▸ WooCommerce linkable product thumbnails ▸ Yes
Please let me know
Alex
ok, thank you.also do you know if it’s possible to limit the number of related products to 3?
check this link of a product in my shop, only 3 related products fit per line, the 4th is on another row.is it possible to limit to 3, or maybe 6? thanks
Please follow this tutorial
https://docs.woocommerce.com/document/change-number-of-related-products-output/
you could add:function woo_related_products_limit() { global $product; $args['posts_per_page'] = 3; return $args; } add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' ); function jk_related_products_args( $args ) { $args['posts_per_page'] = 3; // 4 related products $args['columns'] = 1; // arranged in 2 columns return $args; }
thanks very much, it worked.
you’re welcome 😉
Cheers
Alexsorry to bother you again, i have another issue if you can help.
my shop link is http://www.paftale.ro , as you can see i use the shop page as the home page, but the products aren’t on same height because of the featured images.i have regenerated thumbnails, but the problem it’s still there.any ideas what i can do so the products will be aligned?also is it possible to disable prettyphoto gallery? i don’t know if it’s a bug, but when you’re viewing 2-3-4 product photos and you click to go back to the page you were before, you have to click the go back button the amount of images you have viewed in the prettyphoto gallery.
when you close the galley you’ll have this link https://…/product/productname/#prettyPhoto
after you click go back you’ll end with this links
https://…/product/productname/#prettyPhoto%5Bproduct-gallery%5D/1/
https://…/product/productname/#prettyPhoto%5Bproduct-gallery%5D/0/
etcHi @roseeds
About prettyphoto, to remove #prettyPhoto from the url please edit the following file:
suevafree/assets/js/jquery.wip.js
and replace
function suevafree_lightbox() { $("a[data-rel^='prettyPhoto']").prettyPhoto({ animationSpeed:'fast', slideshow:5000, theme:'pp_default', show_title:false, overlay_gallery: false, social_tools: false, }); }
with
function suevafree_lightbox() { $("a[data-rel^='prettyPhoto']").prettyPhoto({ animationSpeed:'fast', slideshow:5000, theme:'pp_default', show_title:false, overlay_gallery: false, social_tools: false, deeplinking: false }); }
this issue will be fixed as soon as possible
About the thumbnails, suevafree uses woocommerce_thumbnail as thumbnail size for the main shop page.
Please go to appearance > customize > woocommerce > product images and change the size of this thumbnail, then regenerated all thumbs.
I just tested successfully these steps.
Please let me know
Alex
that fixed the prettyphoto issue, thanks very much.regarding the thumbnail, i have set size to 250 px, i will regenerate thumbnails now and see what happens
le: that didn’t seem to work, this are the settings i use for product image https://imgur.com/a/6rM4qNt
i also tried to resize the images to the same sizes, but that didn’t work, the products aren’t aligned.
Hi @roseeds
the products aren’t aligned because of the strikethrough price
You could include the following css code going to appareance > customize > additional css.products-list .product-content .price {
min-height: 35px;
}Please let me know
Alex
hello.it didn’t work, as you can see the first row of products aren’t on sale and still they’re not aligned.
- The topic ‘make product images link’ is closed to new replies.