Neat Way to Show the age of your Website In the Copyright Footer Dynamically

blog cover image
23
13.9K followers
Updated

I came across a neat trick today to code the age of your website into your footer so it changes every year. Quite often you notice that websites have outdated copyright dates, and that is because few people change them. If you have changed yours recently the chances are it will say 2020. The drawback to this is the fact it does nor show how old your web site is. Some of the domains I bought last Century.

Years ago I worked out you can use a simple PHP solution

Simple PHP Solution for Dynamic Copyright Date

To do it this way you add the code to the WP theme files. The most normal way of changing the copyright date is to copy and paste different code into the theme’s footer.php file. .

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


Whilst this code does work your site has to be at least a year old and the drawback is it doesn't take into account the date of your first post. Until today this was the only way I knew how to do it, but today I found a solution for the code for a dynamic copyright date. The link to the article is below. Always do this on a child theme as if you do it on your main site it won't survive an update, which is a great reason to use a child theme


How to Add a Dynamic Copyright Date in WordPress Footer (wpbeginner.com)




    Login
    Create Your Free Wealthy Affiliate Account Today!
    icon
    4-Steps to Success Class
    icon
    One Profit Ready Website
    icon
    Market Research & Analysis Tools
    icon
    Millionaire Mentorship
    icon
    Core “Business Start Up” Training

    Recent Comments

    12

    WP Beginner is one of my favourite websites. They have lots of great info. I have to admit that I am fond of coding as well, but I tend to make a mess out of it too often when I try 🤓. Maybe I should try to be more consistent in my coding training?

    That being said, thank you for good tips on updating the date of your site, bearing in mind ChrystophersJ complementary information.

    Roy

    yes because I always use a child theme I forget that, that is information nI need to pass on. I have amended the article

    That sounds very interesting, indeed, Catherine! If I ever have the need for it, I now know where to look now! Thank you for sharing!

    Jeff

    Hi Catherine, even though this is some great information it is something I will not be getting into.
    Getting into code is something I try my best to stay away from. Too many bad experiences.
    I do appreciate the information.

    All the best,
    Michael

    Thank you Catherine :-) Members just need to be aware that they shouldn’t directly edit their themes footer.php file though, unless they are using a Child Theme, as they will lose the changes when the theme is updated, or if they change the theme. It’s a cool trick, however, to get the dates based on the actual posts :-)

    This is great information. I am always looking for PHP shortcuts to things, but I am not to good at it. Your code line and the website are a great help. Thanks.

    PHP is not my finest talent either

    See more comments

    Login
    Create Your Free Wealthy Affiliate Account Today!
    icon
    4-Steps to Success Class
    icon
    One Profit Ready Website
    icon
    Market Research & Analysis Tools
    icon
    Millionaire Mentorship
    icon
    Core “Business Start Up” Training