- This topic has 8 replies, 4 voices, and was last updated 3 years, 2 months ago by
Anonymous.
-
AuthorPosts
-
January 14, 2023 at 8:53 am #2495473
Anonymous
Hello,
Just got a few questions about Child Theme:
1. What is the best way to create a Child Theme for my website with GeneratePress website?
2. On functions.php I add all php snippets from php snippets plugin? So, I can stop using this plugin, correct?
3. On styles.css do I add all extra CSS code from the Additional CSS field in the customizer? Or what CSS should be added there?
4. Are child themes secure or they are a hacking risk for website since most WordPress hacks come from themes and plugins?
Thanks,
Sara
January 14, 2023 at 12:06 pm #2495635Ying
StaffCustomer SupportHi Sara,
1. check this article: https://docs.generatepress.com/article/using-child-theme/
2. Yes, if you have a child theme installed, you can move all PHP snippets from the plugin to the child theme’s
functions.phpfile, the plugin is no longer needed.3. Yes, you can do so, or you can leave it in the additional CSS field, it doesn’t really matter.
4. I don’t think so.
February 20, 2023 at 7:11 am #2539855Anonymous
Hello Ying,
Sorry for the late reply, I had done that but it seems I am making something wrong since I am getting “There has been a critical error on this website.”, the steps I done are the following:
1) I downloaded generatepres child theme from link you provided
2) I add all php functions that I had on php snippet to functions.php
3) I add all CSS code I got on customizer “Additional CSS” to style.css
February 20, 2023 at 11:18 am #2540294Leo
StaffCustomer SupportIt seems problem comes from functions.php file since I delete all content from file it works fine, what I am doing wrong?
Can you delete the functions one by one and see if you can identify the problem that way?
Or you can remove all functions first, make sure it works, then add the function in one by one.
February 21, 2023 at 5:39 am #2541107Anonymous
Hi Leo,
I just tested as you say function one by one and it seems both functions give error the only part of code that seems to work is the one below:
When I try to add the functions or the add filter code at the end gives error.
Could this be a problem with server permissions? or what you think it could be?
Thanks for your time,
Sara
February 21, 2023 at 6:04 am #2541139David
StaffCustomer SupportHi there,
before you added the child theme, were those PHP Snippets added to the site using any other method ? eg. Code Snippets plugin. If so are they still on the site ?
February 21, 2023 at 7:22 am #2541214Anonymous
Hello David,
You were absolutely right! The moment I deactivated PHP snippets with same code and activated child theme with functions on it worked perfectly.
Can you just make me a favor before closing ticket and delete all code from both files from my previous post?
Thanks a lot for your help and sorry for not considering such a simple solution!
February 21, 2023 at 7:24 am #2541219David
StaffCustomer SupportYou’re welcome, and code deleted 🙂
February 22, 2023 at 6:52 am #2542555Anonymous
Perfect thank you very much 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.