Okay
  Public Ticket #494876
Child Theme Redux
Closed

Comments

  • Fernando Ayala started the conversation

    There was an earlier ticket with the title "Child Theme" but only the last part of the ticket discussion is visible to the public(?)

    I set up a child theme the usual way, with a style.css with an import declaration to the techwise theme in the child theme's folder. However when I try activating the child theme, wordpress says the theme is broken.

    Is there something I'm missing, like perhaps initializing the theme's framework?

    Any help will be appreciated.

  •  330
    Brian replied

    The theme is fully child theme compatible. What specifically does wordpress say? Can you copy and paste or screenshot the error?

  • Fernando Ayala replied

    It\'s okay now. Apparently, the theme breaks when the quick approach to making a child theme is used. I removed the @import() line from the styles.css and implemented the alternate approach (add a function to the functions.php file of the child theme to explicitly initiate the parent\'s css first.)

    Pasting the function code here in case someone else bumps into the issue:

    if ( !defined( \'ABSPATH\' ) ) exit;

    // BEGIN ENQUEUE PARENT ACTION

    if ( !function_exists( \'chld_thm_cfg_parent_css\' ) ):

    function chld_thm_cfg_parent_css() {

    wp_enqueue_style( \'chld_thm_cfg_parent\', trailingslashit( get_template_directory_uri() ) . \'style.css\' );

    }

    endif;

    add_action( \'wp_enqueue_scripts\', \'chld_thm_cfg_parent_css\' );

    // END ENQUEUE PARENT ACTION

    Kindly mark this ticket as resolved.

    Thank you!

  •  330
    Brian replied

    Thanks for the info, I\'ll keep this handy for if anyone else has this issue with the theme.