Pro footer preview area not working

I am trying to put a modified version of this into a text box in the footer of my site…

&copy; 2010<script>new Date().getFullYear()>2010&&document.write("-"+new Date().getFullYear());</script>, Company.

When I do this though it breaks the preview screen for all of the footer but I have no idea why. I would like to have the copyright protection notification and for the year to auto update but I am not sure how to work round it. Could you help please?

Hi There @vincehypno,

Thanks for writing in! You can use the following example code in your footer content area.

<p>Copyright <span id="year">TEXT</span> Company Name - All Rights Reserved.</p>

Then, add the following JavaScript code into your Pro -> Theme Options -> JS area.

jQuery(document).ready(function() {
  var currentYear = (new Date).getFullYear();
  jQuery("#year").text( (new Date).getFullYear() );
});

Hope that helps.

Thanks for your speedy response. It is close but not quite what I was after. I have changed “copyright” to the copyright icon. I would like the bit after this to be set at "2018 - " and for the current year to be autoatically added in so I dont have to remember to change the year every January. I have used the code I referenced on another x site and it updates automatically but on Pro it breaks the preview screen for the footer. Is there any way to auto add in the year after “2018 -” ?

Hi @vincehypno,

The first code will only work on the standard footer, it will break the builder due to document.write, it directly writes the content which the builder is unable to catch.

The second one should work, but yes, please change the content to this

<p>&copy; 2010 - <span id="year"></span> , Company.</p>

Thanks!

1 Like

Perfect. Thanks

You’re most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.