Archived topic
Copyright info with Elementor
21 replies · Started by Dave on April 22, 2018
Hey guys, I am using Elementor Pro with GP Premuim. Elementor (confirmed through their support) doesn't have an option for including "smart copyright" where it places the %copy% and current year code. Is there a way to bring that copyright content in to Elementor? I don't want to have to remember to go back each year and change copyright years for every client.
Thanks!
Hi there,
You mean to bring GP's copyright function to Elementor?
Unfortunately not...
Perhaps just use GP for the copyright section?
I thought about that but I like the flexibility with Elementor being able to insert custom headers and footers. What about a copyright shortcode that would take any text in that entire copyright section and being able to embed it in to Elementor as an element? I think people would find that extremely helpful especially with how popular it and other page builders are becoming.
This should do it:
add_shortcode( 'get_the_year', 'tu_get_the_year' );
function tu_get_the_year() {
return date( 'Y' );
}
Then you could use [get_the_year].
Ok sweet. Should I just put that in functions.php?
Yea :)
Perfect, thanks!
No problem :)
Hi there,
I have the same situation here (footer made with an Elementor Template).
After I had put the code into functions.php there occurred a white screen and my site broke completely. I don't know php at all and maybe I put the code into the wrong place (at the bottom of the file).
I have restored the functions.php file now and I can access the WordPress Backend again.
Now I put the code into the "Code Snippets" Plugin (the plugin which is recommended in the GP documentation "adding PHP") and activated it so that it's active for the whole site.
Is this the right way to do it (also for being on the save side regarding to updates)?
Where do I have to insert the [get_the_year]? Unfortunately, it doesn't work when I try to put this in the text field of the Elementor Title Widget.
Thank you in advance!
That's strange - perhaps your functions.php wasn't set up correctly.
Is your code snippet activated inside the Code Snippets plugin?
Hi Tom,
I hope my functions.php is allright? As mentioned I don't now PHP :(
Yes the snippet is activated (for the whole site) in the Code Snippets plugin.
It works now! In the Elementor Footer Template the "copyright line" (the part at the very bottom in the footer) were the columns and in both were TITLE widgets. I don't know why? Is it better to have title widgets there? I changed them now to TEXT-EDITOR widgets and voilà, it gets the year!
Your code is now still in the Code Snippets plugin. Is it better to have it there (e.g. regarding updates) or should I better try to put it in the functions.php again?
Thank you very much for your help!
Best regards,
Michael
Hi Michael, keep it in the code snippets, never make changes to the parent themes functions or templates or they will be lost when the theme updates. If you were doing large amounts of editing then use a child theme.
Hi David,
Thank you very much for your answer/help.
Ok, I'll keep it in the code snippets then...
Thank you!
You're welcome Michael, glad we could help
Hi,
i added this code in child theme in functions.php (it existed from the beginning), i had created a footer in "footer header elementor" and it works. it catches the year in the copyricht 2018 xxxxx.
but in the web site, it does not work, it appears "copyricht [get_the _year] xxxxx."
add_shortcode( 'get_the_year', 'tu_get_the_year' );
function tu_get_the_year() {
return date( 'Y' );
}
Should i change in child theme and in father theme as well? functions.php (father is bigger than child's)