Never worry about updating the copyright year again! With a few lines of code, you can automatically update the copyright year on your Wix Studio website. This text typically sits in the footer and should reflect the current year.
Here's what you'll need:
A Wix Studio website
A text element in your footer (if you don't have one, add it now)
Follow these steps:
Navigate to the top of your Wix Studio editor and click on Start Coding. This will open the code panel at the bottom of the editor.
Copy and paste the following code into the code panel:
Set the code and forget ever needing to update the copyright year on your website again.
Let's put it together.
$w.onReady(function () { ... }): This code ensures the script runs only after the page finishes loading.
const year = new Date().getFullYear();: This line gets the current year and stores it in the year variable.
$w('#footerCopyright').text = ...: This line replaces the text content of the element with ID footerCopyright with the copyright information.
© ${year}: This displays the copyright symbol and the current year.
Your Company: Replace this with your company name.
\nProudly created with Wix.com: This displays a credit to Wix. You can edit this text as needed.
Important: Don't remove {year} as it displays the current year dynamically.
Make Sure the ID Matches:
#footerCopyright refers to the ID of the text element where you want the copyright information to display.
Unsure of the element ID? Click on the text element and then look at the far right side of the code panel. You'll see the element ID there.
Save and Publish:
Once you've pasted the code and confirmed the element ID, click Save and then Preview to see the updated copyright year.
If everything looks good, publish your website.
$w.onReady(function () {
const year = new Date().getFullYear();
$w('#footerCopyright').text = `© ${year} Your Company \nProudly created with Wix.com`;
});
Need More Help?
Click the link below for a helpful YouTube video that walks you through this process visually.
Important Note:
You'll need to add this code to every page of your website where you want the copyright year to update automatically.
IMPORTANT: Be sure to enter this same code on the masterPage.js so it displays correctly on ever page of your website. Once done, go ahead and click Save then Preview to review your changes prior to Publishing your website. Need additional help? Click below to view our #youtube video showing you how to make this all come together.
View more of our self help videos on YouTube below.
Comments