questions

How to make the image when clicked goes to the product detail permalink?

Rate this post

I have some confusion when editing the CSS code in WordPress to display a link to the permalink product details in WordPress. Is there a friend who can help me? This is my code.

 

<article id="product-<?php the_ID(); ?>" class="productbox">

<div class="content">           
<div class="image productbox-image lazy" data-bg="url(<?php echo $thumb;?>)" >
<?php if ($promo == 'on') : ?>
<span class="ribbon">Promo</span>
<?php endif; ?>       
</div>

<div class="detail">
<?php
the_title('<h3><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h3>');
?>
<div class="desc">
    <?php the_content(); ?>
</div>
<div class="pricing">
    <?php
    echo $prices;
    ?>
</div>

Thank you before

 

✔️Solution:

You could try changing that <div> for image to an <a> and include the permalink in the href of it.

Eg:

<a href="<?php echo esc_url(get_permalink()); ?>" class="image productbox-image lazy" data-bg="url(<?php echo $thumb;?>)" >
<?php if ($promo == 'on') : ?>
<span class="ribbon">Promo</span>
<?php endif; ?>       
</a>

Leave a Reply

Your email address will not be published.

Back to top button