Home / Admin / Replace Special Characters in Post Title
Duplicate Snippet

Embed Snippet on Your Site

Replace Special Characters in Post Title

Replace special characters in Post Title with correct HTML entity

Colin Bunn PRO
<10
Code Preview
js
var myInterval = setInterval(checkForJquery, 50);
function checkForJquery() {
	if (window.jQuery) {
		clearInterval(myInterval);
		fixPageTitles();
	}
}
function fixPageTitles() {
    /* find the page title */
	var originalString = jQuery('h1.elementor-heading-title.elementor-size-default').text();
	/* replace raw special characters with the proper HTML entity */
	if (originalString) {
		var newString = originalString
		.replace("®","<sup>&reg;</sup>")
		.replace("©","<sup>&copy;</sup>")
		.replace("™","<sup>&trade;</sup>");
		jQuery('h1.elementor-heading-title.elementor-size-default').html(newString);
	}
}

Comments

Add a Comment