Using this code
<?php if( have_rows('products') ): ?>
<?php while( have_rows('products') ): the_row(); ?>
<a href="<?php echo the_sub_field('product_link'); ?>">
<div class="category-prods col-sm-6" style="background-image: url('<?php echo the_sub_field('product_image'); ?>'); background-repeat: no-repeat; background-size: cover; background-position: top center;">
<h1><a href="<?php echo the_sub_field('product_link'); ?>"><?php the_sub_field('product_title'); ?></a></h1>
</div>
</a>
<?php endwhile; ?>
<?php endif; ?>
Can anyone tell me why the <a>
tag is closing prematurely? There should only be an <a>
tag wrapping the <div>
and an <a>
tag within the <h1>
tag. Instead I’m getting extra <a>
tags where they shouldn’t be.
because you have nested <a></a>
tags. anchor tags cannot be nested inside of anchor tags http://stackoverflow.com/questions/13052598/creating-anchor-tag-inside-anchor-tag