I am currently trying to brain storm on what would be the best solution to find and replace a certain string throughout an entire website. This is a very large (WordPress) website so manually replacing things would be out of the question.
Essentially, my client has been in business for approx 65 years, throughout the website it is said that they have been in business "for over 60 years". Instead of it saying this I would like for it to automatically get the amount of years they have been in business and replace "over 60 years" with "* years in business* years".
I wrote this simple jQuery code that I know calculates the years they have been in business given the current year and that they were established in 1953.
var yearsActive = (new Date()).getFullYear() - 1953;
I did a little bit on research on search and replacing using jQuery and from what I understand, it is not recommended? Is this correct? Does anybody have any ideas as to how I might want to go about this problem?
Edit: I probably should have mentioned that I do have a solution that I am currently considering temporary, as I mentioned I was reading that such a solution might not be ideal.
$(document).ready(function() {
var yearsAct = (new Date()).getFullYear() - 1953;
var yearsActStr = yearsAct + " years";
var replaced = $('body').html().replace(/over 60 years/g, yearsActStr);
$('body').html(replaced);
});