[Resolved] How to Create Child Theme with Existing Genesis Premium Settings

Home Forums Support How to Create Child Theme with Existing Genesis Premium Settings

  • This topic has 16 replies, 3 voices, and was last updated 2 weeks ago by David.
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #1399984
    Chitika

    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.

    #1400311
    David
    Staff
    Customer Support

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

    #1400808
    Chitika

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

    #1400814
    David
    Staff
    Customer Support

    No – 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.

    #1400823
    Chitika

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

    #1400826
    David
    Staff
    Customer Support

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

    #1400856
    Chitika

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

    #1400898
    Chitika

    Hello David.
    I get this error when I made the change.
    https://ibb.co/SwqCbCJ

    #1400919
    David
    Staff
    Customer Support

    Your child theme must ONLY contain your Custom Functions. It cannot have any of GP’s functions inside it.

    #1400931
    Chitika

    Oh. I just copied the entire file.
    What about style.css, is it the same.
    Only the additional code has to be copied.

    #1401153
    Leo
    Staff
    Customer Support

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

    #1401180
    Chitika

    Ok, 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

    #1401199
    Leo
    Staff
    Customer Support

    Ok, 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.

    #1402416
    Chitika

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

    #1402459
    David
    Staff
    Customer Support

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

    https://docs.generatepress.com/article/using-child-theme/#will-i-lose-my-changes-when-i-add-a-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.

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.