Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: How to get child theme to have priority of parent theme

Discussion in 'Misc WordPress Requests' started by thomasgardner47, Feb 14, 2018.

  1. thomasgardner47

    Guest

    Reply To: How to get child theme to have priority of parent theme, by thomasgardner47

    On the athemes forum we was refered to the stackexchange forums, below is the code they provided to us.

    // Queue parent style followed by child/customized style
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', PHP_INT_MAX);

    function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/styles/child-style.css', array( 'parent-style' ) );
    }

    We assumed that we had to change some of the paramiters, so we ended up with this code

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

    function theme_enqueue_styles() {
    wp_enqueue_style( 'sydney-pro-ii', get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'sydney-pro-ii-child', get_stylesheet_directory_uri() . '/style.css', array( 'sydney-pro-ii' ) );
    }
    ?>

    We have replaced the ‘/styles and changed it.

    Regards
    Thomas

    Reply To: How to get child theme to have priority of parent theme
     
    #1

Share This Page

Monarch Social Sharing Plugin