how to add a dynamic copyright date

How to Add a Dynamic Copyright Date in WordPress

Every year people who own the sites need to prepare a webpages for next twelve months and think about how to add a dynamic copyright date. The content is frequently updated as well. Therefore, the copyright updating can be difficult. We will tell you in our article how to solve this problem and make the process automatic.

If your site is protected by copyright, you must renew this feature every year. So everyone will see that you maintain the site in order. The site will take a high place in the ranking in search systems. So the sign of copyright should be upgraded. This is the problem of every webdeveloper. You should do this with the help of a special automated algorithm.

Perhaps you will also be interested in our article on How to Disable RSS Feeds in WordPress.

Who needs sign of the copyright

A content author needs to be protected against copying. Everyone should know that the information belongs to you. It will make a safe placement of content.

Content copyright is valid for one year. Therefore, the content that was made long ago is better to protect differently. You can get a range: the site creation year — the current year.

What you should change to replace the website copyright year

Current information is located in the footer. It divides to three parts:

  • A special mark © (as copyright symbol HTML5), the word “Copyright” or the abbreviation “Copr.”;
  • The year where the site was made or posted on the Internet;
  • The name of the person, who owns rights for content.

The process of replacing copyright information

There is information about the year of the site creation in the footer. A range of years can be placed there too. Therefore, you must change the year manually. You also can use CMS tools or a special script.

  • FrontPage or Dreamweaver are used by webmasters to fix a date of copyright. It is static. You can change the copyright on one or more pages, if you will use this method.
  • Special server script can be written in different programming languages. It can be PHP, JavaScript or other. This scripts replace the year automatically, when the user are loading the page.
  • You can run the script on the client-computer. Webdevelopers use JavaScript or Flash. Because JavaScript get current year. This method allows you to change the date of copyright before loading the site.

The date in the footer changes automatically: instruction

The day, month and year will be changed automatically, if the correct (current) year is selected. You can read the code samples to use similar code on your site. You will get the current date.
Using PHP tools (see below how to get current year in PHP):

php echo date(Y);?>

 

&copy;<? echo date(Y);?>

 

The use of JavaScrip (see below how to get current year in JavaScript):

<script type="text/JavaScript"> var theDate=new Date() document.write(theDate.getFullYear()) </script>

The date can have a different form. You can choose the design that you like best. Some kinds of dates are suitable for specific topics.

F j, Y g:i a February 08, 2016 12:50 pm
F j, Y February 08, 2016
F, Y February, 2016
g:i a 12:50 pm
g:i:s a 12:50:48 pm
l, F jS, Y Wednesday, February 08, 2016
M j, Y @ G:i Feb 08, 2016 @ 12:50
Y/m/d \a\t g:i A 2016/02/08 at 12:50 PM
Y/m/d \a\t g:ia 2016/02/08 at 12:50pm
Y/m/d g:i:s A 2016/02/08 12:50:48 PM

The copyright: change automatically

CMS are different. Many sites are created using WordPress, but there are others too. For example, old webpages created using HTML. We tried to collect all the ways to automatically replace the copyright date.

What to do, if the site is created using HTML

The copyright sign and year replacing needs a script. It can refer both the server and the computer of client. The date in the site footer will be replaced. There is code below. It is created using PHP. You must add it to your website code. Then the copyright date will be replaced automatically.
To change the year use the code:

<?php echo date("Y"); ?>

 

To change the range of years used:

<?php$fromYear = 2010;

$fromYear = 2010;

$thisYear = (int)date('Y');

echo $fromYear . (($fromYear != $thisYear) ? '-' . $thisYear : '');?>

If you’re using Django, you need the next code. Then the date of copyright will change automatically.

{%now "Y"%}

 

Some webdevelopers use node.js. The code to transform the date looks like this:

new Date().toISOString().substr(0,4)

ASP.NET (dot Net) can also replace the date. You may do this, when you will copy the next code.

Copyright @@ @DateTime.Now.Year

 

Change the copyright year automatically on WordPress sites: instructions

Let’s study how to add a dynamic copyright date in WordPress footer. WordPress uses themes. The appearance of the footer is determined by the theme too. You should use special settings of your theme to be able to edit the footer. So you can replace the copyright date. If you are using server scripts and the client-computer, you need to transform the file ‘footer.php’. The copyright date will become customizable. It will be updated automatically. You should make a backup copy of the site before doing so. Then you will have the opportunity to correct mistakes. Otherwise, the footer will not load correctly.

Next, we’ll look at two instructions how to replace the copyright image.

Let’s start with PHP. This script can be used on the server. Attention, the speed of the site will be slightly reduced. The loading time will increase accordingly.

  1. Start WordPress and select the settings panel.
  2. Click on the section ”Appearance” and select “Editor Menu”. This allows you to edit the current theme. It needs to be activated.
  3. “Theme Footer” is located on the right. Make one click. File ‘footer.php’ will be opened.
  4. Use code created with PHP. You will get the date you need.
  5. Press the “Update File” key. After this action reload the page. Check if the changes work.

how to get current year in php

The second way is associated with JavaScript. To use it, you need a client computer. This code should be added to the footer of the current web page.

  1. Start WordPress and select the settings panel.
  2. Click on the “Appearance” section and select “Editor Menu”. This allows you to edit the current theme. It needs to be activated.
  3. “Theme Footer” is located on the right. Make one click. File ‘footer.php’ will be opened.
  4. The desired date will appear when you paste the JavaScript code.
  5. Press the “Update File” key. After this action, reload the page. Check if the changes work.

javascript get current year

Why do you need WordPress plugins, when setting the date

File ‘footer.php’ needs a script to replace copyright automatically. With the plugin it is easy to do. If you are not engaged in programming, this is one of the best ways for you to achieve the desired result. It is also convenient to use this app when you have several sites. Let’s look at the work of this application.

How does the plugin automatically update copyright year

The plugin works equally effectively on different sites. Its settings are universal. Ad you can get auto update copyright. To make it work, follow these steps:

  1. The widget for the text should be placed on the page of the site.
  2. Use ‘<span>[wpsos_year]< / span>’. This line should be written in the widget. Or you can write this information in the footer, if you use HTML-markup.
  3. Close and open the page. The copyright information should be changed.

auto update copyright

The plugin uses the information from the line above. It will replace the year on the page with the current year.

1 Star2 Stars3 Stars4 Stars5 Stars (5.00 / 5, votes: 1)
Loading...

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>