Woocommerce Shop Page / Archive Page

Views: 27

Product Title Link for Shop Page

Then, you can add the following code snippet to your functions.php file, in a site-specific plugin, or by using a code snippets plugin

remove_action('woocommerce_shop_loop_item_title','woocommerce_template_single_title',5);
add_action('woocommerce_shop_loop_item_title', 'woocommerce_my_single_title',5);

if ( ! function_exists( 'woocommerce_my_single_title' ) ) {
   function woocommerce_my_single_title() {
?>
            <a href="<?php echo get_the_permalink(); ?>"><h2 class="woocommerce-loop-product_title"><?php the_title(); ?></h2></a>
<?php
    }
}

Product Thumb Image Link for Shop Page

Then, you can add the following code snippet to your functions.php file, in a site-specific plugin, or by using a code snippets plugin

if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {
/**
* Get the product thumbnail, or the placeholder if not set.
*
* @subpackage Loop
* @param string $size (default: 'shop_catalog')
* @param int $deprecated1 Deprecated since WooCommerce 2.0 (default: 0)
* @param int $deprecated2 Deprecated since WooCommerce 2.0 (default: 0)
* @return string
*/
function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $deprecated1 = 0, $deprecated2 = 0 ) {
global $post;
if ( has_post_thumbnail() ) {
return '<a href="' . get_permalink( $post->ID ) . '">' . get_the_post_thumbnail( $post->ID, $size ) . '</a>';
} elseif ( wc_placeholder_img_src() ) {
return wc_placeholder_img( $size );
}
}
}

Author:

Leave a Reply