top of page
Crumpled Fabric

1

Automatically Update Copyright Year in WIX

Click URL to copy

Feb 13, 2022

2 min read

WIX Ideas

Tags: JavaScript Velo by WIX User Interaction new Date() getFullYear() Date & Time

Hi there, in this tutorial I will show you how to Automatically Update Copyright Year in WIX using Velo by WIX code. It is a common practice by many to manually go into their website's footer and change the year when the new year has just began. But this can be very demanding, especially for website owners with more than 1 website.


Using Velo by WIX code and a few lines of code, we will be learning how to display a dynamic copyright section in WIX.


ELEMENTS USED

  1. Button or Text Element


UNDERSTANDING THE CODE


According to W3Schools,

JavaScript Date Object lets us work with dates:

  • The newDate method provides a huge information about our date and time. Since it is an object, that means we will need an extension to only get what we are looking for (Current year). For that purpose, we use the getFullYear() Method. Which is defined as;

getFullYear() returns the full year (4 digits) of a date.

Finally, we find a way to display this information on our text or button element (Basically any element that allows us to display text).


For this purpose we use Template Literal. According to Mozilla Developers


Template literals are literals delimited with backticks (`), allowing embedded expressions called substitutions.
Untagged template literals result in strings, which makes them useful for string interpolation (and multiline strings, since unescaped newlines are allowed).
Tagged template literals call a function (the tag function) with an array of any text segments from the literal followed by arguments with the values of any substitutions, which is useful for DSLs.
Template literals are sometimes informally called template strings, but they aren't string literals and can't be used everywhere a string literal can be used. Also, a tagged template literal may not result in a string; it's up to the tag function what it creates (if anything).

// Untagged, these create strings:
`string text``string text line 1
 string text line 2`

`string text ${expression} string text`

// Re-usable template:
const templateFn = expression => `string text ${expression} string text`;

// Tagged, this calls the function "example" with the template as the
// first argument and substitution values as subsequent arguments:
example`string text ${expression} string text`


๐Ÿ“บ WATCH THE VIDEO

COPY CODE BELOW ๐Ÿ‘‡๐Ÿฝ

Code



Leave a comment (0)

Thanks for leaving a comment๐ŸŽ‰

bromar

bromar

Sep 29, 2023

Love the tutorial!!!

You are truly great at creating these instructional videos!! Thank you! I am having trouble figuring out . . 'the triggered email' . . it is not being sent to the user submitting the form, the form and the email to the admin works great. . Could you point me to where this might have already been addressed? or any other help? On a second note. .the submit button success/failure message will go back to the default message once it's connected to the data set(I couldn't figure that out either. )

Reply

Admin

kaan

kaan

Jun 4, 2023

wishlist and rating system

hello sir I try today 2 hours but not working if you want I pay money can you do this 2 ( wishlist and rating star) system please I send to you invaid

Reply

Admin

Waqas

Waqas

Apr 16, 2023

Triggered Email Backend

Hi mate please can you send email by backend

Reply

Walter Odibi

Walter Odibi

Admin

Hi Waqas, there isn't a backend code for this tutorial. The emails will be sent from the client-side.

Ghan

Ghan

Dec 29, 2022

Great Tutorial

Hi !

First of all, I want to thank you for your great tutorials, they helped us a lot with the coding.
But I still need your help, if you don't mind. I have based on Save Calculated Field using Wix Data Hooks Codes, to code my form . but the problem is I don't know why the code only reads the computation for "week2" computation and not the "weeks"

here is the code

I also did a separate column in the dataset where the chosen datas for both fields will be placed.

$w.onReady (() => {
$w("#Person").onChange(() => {
$w("#weeks").onChange(() => {
$w("#week2").onChange(() => {
let person = Number($w("#Person").value);
let weeks = Number($w("#weeks").value);
let week2 = Number($w("#week2").value);


$w("#totalLabel").show();

$w("#totalLabel").text = `"${String(weeks * Number(person))}ํŽ˜์†Œ"`; //DESIGN YOUR MESSAGE
$w("#totalLabel").text = `"${String(week2 * Number(person))}ํŽ˜์†Œ"`; //DESIGN YOUR MESSAGE

});
});
});

});

Reply

Walter Odibi

Walter Odibi

Admin

Hi there, thanks for your comment. I see why this is a problem. The onChange() function seems wrong in combination.

To combine onChangeFunctions use this method

$w("#Person, #weeks, #weeks2").onChange(() => {

//code here

});

Walter

Walter

Aug 8, 2022

More Details? Watch video

Hi, you can click here to watch the video https://www.youtube.com/watch?v=9bx7-nBeZ5c

Reply

Walter Odibi

Walter Odibi

Admin

Walter

Walter

Jul 11, 2022

For you

Reply

Walter Odibi

Walter Odibi

Admin

Walter Odibi

Walter Odibi

Apr 18, 2022

Awesome Feature

This tutorial shows you how to display views on your Wix repeater.

๐Ÿ“บWATCH VIDEO HERE https://www.youtube.com/watch?v=Iz7SdaCSdXg

Reply

Walter Odibi

Walter Odibi

Admin

Walter Odibi

Walter Odibi

Apr 18, 2022

Amazing tutorial

This amazing tutorial will show you how to a comment section to your WIX dynamic page.

๐Ÿ“บWATCH VIDEO HERE https://www.youtube.com/watch?v=f8-vJQFNZ_c

Reply

Walter Odibi

Walter Odibi

Admin

Walter Odibi

Walter Odibi

Apr 10, 2022

Great Feature๐ŸŽ‰

This amazing tutorial will show you how to add a visitor view counter to your WIX dynamic page.

๐ŸšฉMORE TUTORIALS https://www.wixgenius.com/wix-tutorials

Reply

Walter Odibi

Walter Odibi

Admin

RELATED TUTORIALS ๐Ÿš€

Selectable Wix Buttons

Selectable Wix Buttons

Add Selectable Wix Buttons to your Wix website using Wix buttons and velo.

bottom of page