Optimizing WooCommerce Product Category Pages for Search Engines
At the moment I'm under a 4-weeks contract with a Jewelry manufacturer from Central London for optimizing their website.
We've dealt with lots of items that needed to be addressed for their WordPress WooCommerce website project and we've arrived at the point where I am doing some SEO optimization for them.
Their theme uses some templates that are overwriting the WooCommerce default templates, among them being also:
archive_product.php
In this template their previous wordpress developer added two headers, one for the desktop and one for mobile.
Apart from retaining only one of the headings as H1, the one for the desktop, and making the one from the mobile header a regular paragraph with the initial look and feel of the H1, I'm now dealing with the product category description, which is again listed twice, once for the desktop and once for mobile.
I won't insist on the fact that it could have been one single header, made responsive!
In order to change only one of the two occurrences of:
<?php if ($bg_image) { do_action( 'woocommerce_archive_description' ); } ?>
Which produces:
<div class="term-description"><p>My customer's product category custom description here.</p></div>
With something to produce:
<h2 class="term-description">My customer's product category custom description here.</h2>
I'm replacing the initial coding listed above with:
<?php if ($bg_image) { echo '<h2 class="term-description">' . $queried_object->description . '</h2>'; } ?>
You're welcome to follow this sample on your WooCommerce project or to hire me for any WooCommerce custom development that you might need.
Kind Regards,
Mihai Bocsaru
Posted by Mihai Bocsaru on July 12, 2019
Permalink | Comments (0)