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