Site logo

Archived topic

Questions about Child Theme

8 replies · Started by Former User on January 14, 2023

Viewing posts 1–9 of 9

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

Hi 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.php file, 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.

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

It 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.

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

Hi 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 ?

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!

You're welcome, and code deleted :)

Perfect thank you very much :)

This archived topic is closed to new replies.