Add a copyright year programmatically to your website footer

A

Especially in January, you start thinking about copyrights on your websites. This is one of those maintenance tasks ripe for a programmatic solution. There is no reason to manually update the years on your website’s copyright year after year. Here are a few good options for creating an automatically updating copyright year on your website.

JS script and HTML Div

<script>
myDiv = document.GetElementById("myDivId");
myDiv.innerHTML = month[day.getMonth()]; // you can add any HTML markup here
</script> 
<div id="myDivId"></id>

Original inspiration from this post: fix without javascript error.


Change copyright year automatically with inline Javascript

<html>
<p>Copyright &copy; <script>now=new Date(); year=now.getFullYear(); document.write(year);</script> Company Name.</p>
</html>

If you’re using a visual builder in WordPress, remember you can often choose the Text tab instead of the Visual tab so that you can include a script in your text box.

If you're using a visual builder in WordPress, remember you can often choose the Text tab instead of Visual tab so that you can include a script in your text box.

PHP copyright year for WordPress PHP file

<p>&copy; <?php echo date('Y'); ?> Company Name</p>

Copyright Variable for Year in HubSpot

 © {{year}} Company Name. All rights reserved.

Add Copyright to SquareSpace – Inline Javascript

You can use the code block in SquareSpace to add a copyright year. Here’s a video that shows you how to do it. For more details, check out our post about SquareSpace.

About the author

Kelly Barkhurst

Designer to Fullstack is my place to geek out and share tech solutions from my day-to-day as a graphic designer, programmer, and business owner (portfolio). I also write on Arts and Bricks, a parenting blog and decal shop that embraces my family’s love of Art and LEGO bricks!

Add comment

Recent Posts

Archives

Categories