- This topic has 21 replies, 6 voices, and was last updated 3 years, 7 months ago by
David.
-
AuthorPosts
-
April 22, 2018 at 11:40 am #557371
Dave
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!
GeneratePress 2.0.2GP Premium 1.6.2April 22, 2018 at 9:18 pm #557595Leo
StaffCustomer SupportHi there,
You mean to bring GP’s copyright function to Elementor?
Unfortunately not…
Perhaps just use GP for the copyright section?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 24, 2018 at 8:56 am #559202Dave
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.
April 24, 2018 at 8:27 pm #559700Tom
Lead DeveloperLead DeveloperThis 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]
.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 25, 2018 at 8:45 am #560166Dave
Ok sweet. Should I just put that in functions.php?
April 25, 2018 at 10:01 am #560226Tom
Lead DeveloperLead DeveloperYea 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentApril 25, 2018 at 11:07 am #560289Dave
Perfect, thanks!
April 25, 2018 at 3:04 pm #560490Tom
Lead DeveloperLead DeveloperNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 14, 2018 at 2:44 pm #575597Michael
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!
May 14, 2018 at 8:35 pm #575738Tom
Lead DeveloperLead DeveloperThat’s strange – perhaps your functions.php wasn’t set up correctly.
Is your code snippet activated inside the Code Snippets plugin?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/
Ongoing Development: https://generatepress.com/ongoing-developmentMay 15, 2018 at 2:25 pm #576505Michael
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,
MichaelMay 15, 2018 at 3:02 pm #576525David
StaffCustomer SupportHi 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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/May 15, 2018 at 3:05 pm #576532Michael
Hi David,
Thank you very much for your answer/help.
Ok, I’ll keep it in the code snippets then…
Thank you!May 15, 2018 at 3:07 pm #576536David
StaffCustomer SupportYou’re welcome Michael, glad we could help
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 9, 2018 at 6:01 am #722896Aitor
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)
-
AuthorPosts
- You must be logged in to reply to this topic.