Need help creating child theme for Swell Lite
-
Hi there,
I’m new to coding, website design and all of that. So when I created a website, I uploaded a theme and made changes in the stylesheet, not realizing that was a terrible thing to do. I now understand I need a child theme so I can make changes safely without risking losing all of my hard work.
I read a “how-to” article by WordPress online and followed it step by step, but did not see the results the article said I should see.
This is the code I put into the child theme stylesheet I created in my file manager:
/* Theme Name: Swell Lite Child Theme URI: https://wifeinthewildblueyonder.com/swell-lite-child/ Description: Swell-Lite Child Theme Author: Alexis M. Rose Author URI: https://wifeinthewildblueyonder.com Template: swell-lite Version: 1.0.9 License: GNU General Public License v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Tags: light, gray, white, green, silver, one-column, two-columns, right-sidebar, responsive-layout, fluid-layout, custom-background, custom-header, custom-menu, featured-images, featured-image-header, flexible-header, full-width-template, translation-ready, sticky-post, threaded-comments, editor-style, theme-options, photoblogging Text Domain: swell-lite-child */
Then, according to the “how-to” article, I needed to include the following code in a functions.php file to enqueue the parent and child theme style sheets:
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } function theme_enqueue_styles() { $parent_style = 'parent-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ) ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
However, this code was breaking the site and not working at all. So I modified the code and this is what I currently have in the functions.php file for my child theme:
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); $parent_style = 'parent-style'; wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/font-awesome.css' ); wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style-editor.css' ); wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style-mobile.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ) ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); ?>
According to the article, I should see the stylesheet completely loaded into the child theme. But it’s not.
After all of that, my questions are: How do I fix this? How can I make my child theme work? What am I doing wrong?
Here is a link to my site, which is currently displaying the child theme:
https://wifeinthewildblueyonder.com/wp/Thank you so much in advance for your help. I want to fix this before going live with the site.
Cheers,
Alexis
- The topic ‘Need help creating child theme for Swell Lite’ is closed to new replies.