Child Theme in Shapely

Hi there,
I’m doing a child theme in localhost, but somehow can’t get the CSS straight. Everything looks just strange.

this is what my style.css looks like:

/*
Theme Name: shapelychild
Theme URI: http://localhost:8888/wordpress/wp-content/themes/shapelychild/
Description: Shapely Child Theme
Author: soraya
Author URI: http://localhost:8888/wordpress/
Template: shapely
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: shapely
*/

and the functions.php:
<?php
add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
function theme_enqueue_styles() {
wp_enqueue_style( ‘shapely-style’, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘shapelychild-style’,
get_stylesheet_directory_uri() . ‘/style.css’,
array(‘shapely-style’)
);
}
?>

Did I get this right?

Hi @soraya,

I hope you are well today and thank you for your question.

Try using the below code in the functions.php file of your child theme.


<?php
// Queue parent style followed by child/customized style
add_action( 'wp_enqueue_scripts', 'func_enqueue_child_styles', 99);

function func_enqueue_child_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_dequeue_style('shapely-style');
    wp_enqueue_style( 'shapely-style',
        get_stylesheet_directory_uri() . '/style.css',
        array('parent-style')
    );
}

Best Regards,
Movin

It works! Thank you!

You are most welcome here :slight_smile:

Hi Movin,

I have installed a shapely child theme given by you in a forum. Please note that when i am adding one more page and setting the template as home page as i want to have the parallax effect on that page. those parallax changes are reflecting on all other pages which have home page template. please help.

regards,
Abdullah.
my website is tschamps…com

@Abdullah This topic is old and the theme is changed a lot so to help us keep support thread separates could you please create your own thread for your question here https://colorlibsupport.com/c/shapely/ instead of replying on others thread as it makes the thread messy and hard to read.

If you want to you can also add reference of this thread in your newly created thread.

We would be more than happy to help you on your new thread.