Auto update copyright year
This support request was posted in Paeon by LizavdVelden
- LizavdVelden July 29, 2015 at 10:02 am
Hi Juan,
I want to add a code that automatically displays the current year in the copyright section of the footer. I tried adding custom code, but it had no effect. I also tried adding: and a PHP-implementation plugin (via the theme options).
Do you know how to implement a code that automatically displays the current year in the copyright section of the footer? 🙂
Looking forward to hearing from you,
Liza
Juanfra Aldasoro July 29, 2015 at 2:14 pmHello Liza,
Thank you for writing. Well, the copyright can be customized through the theme options panel, in the “Footer” section, and it can be customized aswell through the code.
The function used to display the copyright section is named nice_copyright(), and it has several filters for you to customize it via code.
The function to get the current year in php is the following:
date('Y');
You can read more about the different ways to use that function here: http://php.net/manual/en/function.date.php
So, a way to change that through filters is described here: https://gist.github.com/juanfraa/9788834659d14017a2e4
Best,
Juan.LizavdVelden July 29, 2015 at 3:04 pmHi Juan,
Thanks a lot!
But where can I find the nice-copyright-text.php file?
Regards,
Liza
Juanfra Aldasoro July 29, 2015 at 5:53 pmHello Liza,
Thanks for the follow up. There’s no nice-copyright-text.php file, the gist snippet is just a function that will make the trick, you can include that in your themes functions.php file.
Best,
Juan.LizavdVelden July 30, 2015 at 8:35 amHi Juan,
Thanks again, it works great!
However, I want to change the order of the elements, I prefer to have the copyright + date first, and my company name after the date. I tried changing the code, but it didn’t work. Do you know how to change the order of the copyright elements? 🙂
I also want to add a disclaimer pdf in the copyright section, is there a way to add it to the copyright php? (The most convenient solution for me would be that the copyright section automatically displays the © and the date, followed by the Custom Copyright Text added in the footer section of the theme options.)
Would be very nice if you know a solution to the above issues! 🙂
Kind regards,
Liza
Juanfra Aldasoro July 30, 2015 at 2:50 pmHello Liza,
Thanks for the follow up.
Well, you can change the order as you need. To change the order of the elements you need only to play around with the code I’ve sent you: https://gist.github.com/juanfraa/9788834659d14017a2e4
Perhaps it didn’t work because you didn’t take into account that the current year is a variable and you have to concatenate that: http://php.net/manual/en/language.operators.string.php
$text = '© ' .date( 'Y' ) . ' My Company' ;
You are free to customize the code I’ve sent you in the way you need. Unfortunately we can’t provide an exact customization, but just show you the way on how to do it.
With regards to disclaimer, you can use the “Footer Navigation Menu” for that. You can add a custom link directly linked to the PDF file.
We’ve created an article explaining how to use Navigation Menus: http://nicethemeswp.com/article/setting-navigation-menu/
The footer navigation menu is the one appearing on the bottom right part of the demo page: http://demo.nicethemeswp.com/paeon/ – Where it says: “Home Sitemap Contact Us Buy Paeon”
Best,
Juan.
This topic is marked as resolved
Only the topic author can re-open this thread.