- This topic has 16 replies, 3 voices, and was last updated 3 years, 6 months ago by David.
-
AuthorPosts
-
August 12, 2020 at 8:43 pm #1399984Chitika
I have made changes to the existing theme which includes functions.php and CSS.
I want to make a child theme of it, so no changes are overwritten in the next update of GP.August 13, 2020 at 1:55 am #1400311DavidStaffCustomer SupportHi there,
this article explains how to add a child theme – it includes a link to a starter child theme zip:
https://docs.generatepress.com/article/using-child-theme/
Once installed cut and paste your custom functions and CSS to the child theme.
August 13, 2020 at 6:24 am #1400808ChitikaHow about copying the “generatepress” folder under wp-content/themes to a new folder like “gp-xxxx” which act as a child theme. Then I can activate this theme from WordPress dashboard. This way I can keep all the changes I made till now.
Is that correct ?
August 13, 2020 at 6:27 am #1400814DavidStaffCustomer SupportNo – that would just be making a copy of GeneratePress and all of its code.
And this new copy would not receive any updates.Child Themes should only contain ‘replacement’ or ‘additional’ code.
August 13, 2020 at 6:34 am #1400823ChitikaOne more clarification.
I made changes using Appearance > Customize > GeneratePress > Additional CSS.I added some code here. Will I lose these changes when I make a new child theme as mentioned above.
https://docs.generatepress.com/article/using-child-theme/This part confuses me.
The only time you risk losing changes is when you make them to the parent theme files or use the Additional CSS field from WordPress.
August 13, 2020 at 6:38 am #1400826DavidStaffCustomer SupportAdditional CSS is saved in the Theme. You will need to copy and paste that into your child theme styles.css or into additional CSS once the child theme is enabled.
August 13, 2020 at 6:57 am #1400856ChitikaAs I understand these are following things to be done for my customization.
1. Copy the parent functions.php file which has some customization to child theme, which is blank.
2. Copy the additional css to style.css of child theme.So next time, when update to parent GP theme happens, these changes remain intact.
Right?
August 13, 2020 at 7:20 am #1400898ChitikaHello David.
I get this error when I made the change.
https://ibb.co/SwqCbCJAugust 13, 2020 at 7:39 am #1400919DavidStaffCustomer SupportYour child theme must ONLY contain your Custom Functions. It cannot have any of GP’s functions inside it.
August 13, 2020 at 7:43 am #1400931ChitikaOh. I just copied the entire file.
What about style.css, is it the same.
Only the additional code has to be copied.August 13, 2020 at 8:29 am #1401153LeoStaffCustomer SupportYou don’t need to copy the
style.css
from the parent theme to your child theme.The child theme will grab that file for you automatically.
August 13, 2020 at 8:41 am #1401180ChitikaOk, so if i add the ADDITIONAL CSS code to style.css of parent theme, is it enough.
do i need to add to style.css of child theme also.What about this part.
If the child theme’s style.css file is empty and you’d like to avoid loading it, try this PHP snippet below:
add_action( ‘wp_enqueue_scripts’, function() {
wp_dequeue_style( ‘generate-child’ );
}, 50 );should i add the above PHP code if i make changes to parent theme style.css
August 13, 2020 at 8:54 am #1401199LeoStaffCustomer SupportOk, so if i add the ADDITIONAL CSS code to style.css of parent theme, is it enough.
Don’t do that – it will get erased during updated.
Simply add your Additional CSS in child theme’s
style.css
and you are done.August 14, 2020 at 4:56 am #1402416Chitikawhat about content added to footer bar.
Before the recent GP Premium plugin update, I added some HTML/TEXT code to footer bar.
This got deleted when the plugin update was done.So what about the settings from Customize > GeneratePress.
Do they remain even after update like font size, header bar etc.Or is it better to have a child theme for that.
August 14, 2020 at 5:27 am #1402459DavidStaffCustomer SupportThe basic rules are this:
1. Never edit the parent theme files. Those changes will be lost when the Theme updates. This is controlled by WordPress and the theme has no control over that.
2. Some customizer changes such as Logos, Copyright and Additional CSS are stored in the Theme database. So those will need to be copied to a new / child theme.
3. All Customizer changes, activated modules and elements etc. are stored in your sites database. Any changes you made in the Parent Theme will still be present in the child theme.
-
AuthorPosts
- You must be logged in to reply to this topic.