IOM Partners of Houston

A comprehensive range of Houston Website Design Services now on offer from IOM Houston which is the market as well as segment leader in web design and development solutions through its professional team of website designers who possess years of industry s

Displaying a Dynamic Copyright at the Footer of Your WordPress Website

Displaying a copyright date at the footer of the website is something that is quite common for websites. Displaying the copyright mark and the date at the footer of the page does have a lot of advantages. First of all, it would keep plagiarizers at bay. People would think twice before copying the content. It also gives a professional touch to your website. The copyright mark plays an important role in building trust as well. However, displaying a static date with the copyright might not be a good idea. If you only display the date of the beginning of the website, then that would make your website appear as unprofessional. On the other hand, if you only display the current year, than the user would have no idea how old your website is. So, a smart idea would be to display a dynamic copyright date in the footer of your website.

 

To display a dynamic copyright date in your WordPress website, you just need to make few changes to the PHP code. If you are a Houstonian and you are not well versed with PHP coding, then you can take the help of a professional Houston Website Design company. Copy and paste the following code to the functions.php file

 

1&copy; 2009 – <?php echo date('Y'); ?> YourSite.com

 

You need to replace ‘yoursite.com’ with the URL of your website.

 

Now, there is an issue with this code. Your website needs to be a year old for this code to work properly. You can take the help of the following method, as it offers a better solution to the issue.

 

The following code would display the copyright date based on date of publishing of the oldest post and the newest post. If this is the first year of the website, then the current year would be displayed in the copyright date.

 

Just open the functions.php file of your theme and insert the following code.

 

01

function comicpress_copyright() {

 

02

global $wpdb;

 

03

$copyright_dates = $wpdb->get_results("

 

04

SELECT

 

05

YEAR(min(post_date_gmt)) AS firstdate,

 

06

YEAR(max(post_date_gmt)) AS lastdate

 

07

FROM

 

08

$wpdb->posts

 

09

WHERE

 

10

post_status = 'publish'

 

11

");

 

12

$output = '';

 

13

if($copyright_dates) {

 

14

$copyright = "&copy; " . $copyright_dates[0]->firstdate;

 

15

if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {

 

16

$copyright .= '-' . $copyright_dates[0]->lastdate;

 

17

}

 

18

$output = $copyright;

 

19

}

 

20

return $output;

 

21

}

 

After you are done with that, open the footer.php file and insert the following code at the position where you want to display your copyright date.

1<?php echo comicpress_copyright(); ?>

 

If you want to design a professional as well as attractive website for your business, then you can take the help of the leading experts in the field of Website Design Houston . These companies would have the expertise that would help them to include such features into your website that would make it look professional. So, take the help of the leaders and design a truly astonishing website for your business.