Support » Theme: Blaskan » linking parent file to child theme

  • I am using this php function file.

    <?php
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . 'http://www.giftforgag.com/wp-content/themes/blaskan/style.css' );
    
    }
    ?>

    I want to know how to link up the parent theme to child theme. Here I have used the full URI but it is not working. I have been asked to convert this whole uri to simple ‘/style.css’. But how do I do this?

Viewing 1 replies (of 1 total)
  • The following worked for me. Put this in the functions.php file in your child theme.

    <?php
    /**
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    * Enqueu the parent and child theme stylesheets//
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    */
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    function theme_enqueue_styles() {
        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')
        );
    }
    ?>

    Be sure you have the following at the top of your style.css file in your child theme:

    /*
    Theme Name: Blaskan Child
    Theme URI:    http://www.giftforgag.com/wp-content/themes/blaskan-child/
    Description:    Child theme for the Blaskan theme
    */

Viewing 1 replies (of 1 total)
  • The topic ‘linking parent file to child theme’ is closed to new replies.