Last active
July 12, 2017 17:22
-
-
Save ravixp/26d2ae1182dcd5782f827dad126bacb7 to your computer and use it in GitHub Desktop.
Magento 1: Check if H1 tag is existing on the product description. The client wants to add the H1 tag on the description in the certain products (magento backend). Change H1 to H2 in the page title if H1 found on the description.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php $product_description = $_helper->productAttribute($_product, $_product->getDescription(), 'description'); ?> | |
| <?php if( strstr($product_description, '<h1') ) : // Check if H1 tag exists on the description ?> | |
| <div class="page-title"> | |
| <h2 class="h1-page-title h1-title-exists-on-description"> | |
| <?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?> | |
| </h2> | |
| </div><!--/.page-title --> | |
| <?php else: // Check if H1 tag exists on the description ?> | |
| <div class="page-title"> | |
| <h1 class="h1-title-NOT-found-on-description" itemprop="name"> | |
| <?php echo $_helper->productAttribute($_product, $_product->getName(), 'name'); ?> | |
| </h1> | |
| </div><!--/.page-title --> | |
| <?php endif; // Check if H1 tag exists on the description ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment