Created
June 3, 2025 09:58
-
-
Save webtoffee-git/9f925301a0b1a9cf8e06df54525a2fd3 to your computer and use it in GitHub Desktop.
Code to change the related product widget heading from h1 to h3 - By WebToffee (Related products Basic plugin)
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> //Do not copy this line of code | |
add_action('wp_footer', function () { | |
if (is_product()) { | |
?> | |
<script> | |
jQuery(document).ready(function () { | |
const container = jQuery('.wt-related-products'); | |
if (container.length > 0) { | |
const h1 = container.find('.wt-crp-heading'); | |
if (h1.length) { | |
const h3 = jQuery('<h3>', { | |
class: h1.attr('class'), | |
style: h1.attr('style'), | |
html: h1.html() | |
}); | |
h1.replaceWith(h3); | |
} | |
} | |
}); | |
</script> | |
<?php | |
} | |
}, 20); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment