Change Text within Nested Class, Populate Dynamic Year & Concatenate in js – For WordPress Copyright

Views: 68

Code to display year with Concatenate inside Nested Class

Triggering them in footer to make them work,

add_action( 'wp_footer', function () { ?>
<script type="text/javascript">
	var copyrightsymbol = '©';
	var year = new Date().getFullYear();
	var company = 'Chappelle Medical Clinic. ALL RIGHTS RESERVED.';
	 
	document.querySelector('.copyright-footer p').innerHTML = copyrightsymbol.concat(" ", year, " ", company);
</script>
<?php } );

To get full year,


new Date().getFullYear();

Using QuerySelector to select the nested class & using innerHTML to replace the content with

document.querySelector('.copyright-footer p').innerHTML = copyrightsymbol.concat(" ", year, " ", company);

Author:

Leave a Reply