0

Hi I used the Edin theme to build a wordpress website. I modified a big part of the CSS at the CSS editor, without having a clue what a child theme is. What should I do now? Create a child theme and delete the additional CSS of the parent theme? Any ideas?

Thank you very much!!

  • When you say the “CSS Editor”, what specifically are you referring to? Did you use the Theme Editor to edit the style.css file? Or did you add CSS to The Additional CSS section of Appearance > Customize? – Jacob Peattie Jan 17 at 13:15
  • I added CSS to the Appearance > Customize> Additional CSS to change maily fonts, colors etc – Ani Kanakaki Jan 17 at 13:24
  • Then you don’t need to do anything. You haven’t modified the theme, you’ve just added CSS using the proper method. A child theme is if you need to make more substantial changes as an alternative to modifying a theme’s files, which you haven’t done. – Jacob Peattie Jan 17 at 13:26
0

As Jacob Peattie mentioned, you've made custom CSS changes in a way that does not impact your theme. To expand a bit more, this is the only place you can make changes that will persist through a theme update or change. All other customizations get wiped. So if you find you want to make further changes, you can create a child theme. You'll need access to the server/file system for this.

First create a new folder/directory in wp-content/themes/

You need to add two files to this directory: style.css and functions.php In the style.css file add the following information:

/*
 Theme Name:   Edin Child
 Template:     edin
*/

Those are the only two required things in this file. Note that I have assumed that the "Template" is "edin"; make sure this is actually the parent theme directory name. More info.

Next is the functions.php file, which is a little more involved. Here is where tell your child theme to import information from its parent as well as importing its own style info.

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {

    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); // get_template_directory_uri() returns the URI of the current parent theme, set in "Template" in your style.css
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    ); // get_stylesheet_directory_uri() returns the child theme URI
}
?>

Then you'll have to zip your child theme directory up and upload it via the WP admin (or upload via ftp to /wp-content/, no zipping required), and finally activate the child theme. More info.

You can find more about creating child themes directly from the WordPress theme development docs.

-1

If you've changed the original theme files, create a child theme and move your changes to the new style.css of the child. If you don't remember what your changes were, just copy the modified style.css from parent to child and reinstall the parent theme.

If you just added the CSS in the customizer then you don't have to do anything since the changes will remain even if the theme is update.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.