• Resolved kenvogt

    (@kenvogt)


    I would like to make a child theme but it keeps breaking. So I dumbed it down to two files, style.css and functions.php. The files are shown below. They actually add no functionality at all. Unfortunately, they break the css. The css from the parent style does not show up. These two files are in wp-content/themes/spacious-child/ and the parent theme is in wp-content/themes/spacious/. What am I doing wrong?

    style.css

    /*
    Theme Name: Spacious Child
    Theme URI: https://themegrill.com/themes/spacious
    Description: Spacious Child
    Author: Kenneth Vogt
    Author URI: https://themegrill.com
    Template: spacious
    Version: 1.0.0
    License: GNU General Public License v2 or later
    License URI: https://www.gnu.org/licenses/gpl-2.0.html
    Tags: light, white, dark, two-columns, right-sidebar, left-sidebar, fluid-layout, responsive-layout, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, featured-images, theme-options
    Text Domain: spacious-child
    */

    functions.php

    <?php
    
    function theme_enqueue_styles() {
    	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    
    ?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • Can you temporarily enable debugging and see if any errors appear? Your code works for me.

    Thread Starter kenvogt

    (@kenvogt)

    Ok, I changed functions.php to:

    <?php
    
    define( 'WP_DEBUG', true );
    define( 'SCRIPT_DEBUG', true );
    
    function theme_enqueue_styles() {
    	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    
    ?>

    When I load the page I see no errors in the console and variously I see these messages:

    “JQMIGRATE: Logging is active”

    “JQMIGRATE: Logging is active”

    Can you post a link to your site with the child theme active?

    Thread Starter kenvogt

    (@kenvogt)

    Your site appears fine to me. Both the parent and child theme’s stylesheets are loading correctly and WP is reading CSS from both of them. Are you using a caching plugin or is your host caching your site?

    In your original post, you mentioned that you “dumbed it down to two files”; were there any errors prior to doing so?

    Thread Starter kenvogt

    (@kenvogt)

    No, there were no errors prior. I have been purging all the caches at my host and clearing my local cache. While it doesn’t look ugly, it is not using the theme. The header image is gone, elements are showing up that are hidden in the theme and it is not using the menuing css.

    When you switch to the child theme, it’s like switching to a new theme. You usually have to reassign any custom header images, navigation menus, widgets, etc., just like you did when you originally set up the parent theme.

    Thread Starter kenvogt

    (@kenvogt)

    Yes of course, that makes sense. Thanks!

    Thread Starter kenvogt

    (@kenvogt)

    That was it, thanks Stephen.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘basic child theme functionality is not working’ is closed to new replies.