• Resolved almcr

    (@almcr)


    functions.php
    =============

    
    <?php
    /**
     * @package Scrawl Child Theme
     */
    /**
     * Load the parent and child theme styles
     */
    function scrawl_parent_theme_style() {
    	// Parent theme styles
    	wp_enqueue_style( 'scrawl-style', get_template_directory_uri(). '/style.css' );
    	// Child theme styles
    	wp_enqueue_style( 'scrawl-child-style', get_stylesheet_directory_uri(). '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'scrawl_parent_theme_style' );
    

    style.css
    =========

     
    /*
    Theme Name: Scrawl Child 
    Version: 1.0
    Text Domain: scrawl-child
    Template: scrawl
    */
    

    I cannot get a child theme of scrawl to work correctly. I created a child theme with 2 files, functions.php and style.css. The contents of those files is listed above.

    Whenever I activate the scrawl child theme, the info put into the url for the parent style sheet is always set to ‘scrawl-child/style.css’ rather than ‘scrawl/style.css’. I use the same code in a child theme for the ‘atomic-blocks’ theme, it is just not setting the path correctly in the generated code. This is the code generated:

    
    <link rel='stylesheet' id='scrawl-style-css' href='http://localhost/wordpress/wp-content/themes/scrawl-child/style.css?ver=5.4.1' type='text/css' media='all' />
    

    Where does that ‘-child’ come from?? How do I create and use a child theme for scrawl?

    scrawl and atomic-blocks themes are both available on wordpress.org.

    Al

    I am on a local test system, wordpress 5.4, gutenberg 8.2.1, the child theme does not work on a hosted wordpreess either.

    • This topic was modified 5 years, 11 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter almcr

    (@almcr)

    did find a solution to generating a usable child theme, I used the Child Theme Configurator plugin, and that seems to work fine.

    Al

    Moderator bcworkz

    (@bcworkz)

    Stylesheet paths are filterable, so the erroneous path could come from anywhere. How does the Scrawl theme enqueue its style.css? If it’s using get_stylesheet_directory_uri() you may need to dequeue it. Since child themes load first, dequeue code needs to be called from a later action hook. In any case, be sure you are using the correct style handle from the parent.

    You need to specify the parent style as a dependency of your child style to ensure the child styles take precedence over parent. Refer to the examples here:
    https://developer.wordpress.org/themes/advanced-topics/child-themes/#3-enqueue-stylesheet

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘scrawl child theme’ is closed to new replies.