Footer text in websites typically have the current year text.

Let's see how this can be made dynamic i.e., automatically showing the current year in Oxygen.

Step 1

Install and activate Code Snippets plugin if you have not already.

Step 2

Add a new Snippet with a title of say "Current year" having the following code:

function sk_current_year() {
    echo date( 'Y' );

You can leave sk_current_year as is or replace it with your desired function name (make sure it does not contain spaces or hyphens).

Step 3

In the Oxygen editor place the cursor wherever you want the current year to appear, then click on Insert Data, then PHP Function Return Value and paste sk_current_year (i.e., the name of the function we created in the earlier step) in the Function Name field and Insert.

The value may not appear in the editor but should work on the frontend.

Need help implementing a tutorial in your site or want to hire me for custom work?


Find the article helpful and wish to donate?



You need to be logged in to view and post comments.
Not a member yet? Join here.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: