• Resolved joyryde

    (@joyryde)


    Hoping someone can help me fix this.

    For some reason my website is redundantly calling the same child stylesheet twice in the html:

    <link rel='stylesheet' id='child-style-css' href='https://www.miamirealestateguy.com/wp-content/themes/Serene_child/style.css' type='text/css' media='all'/>
    <link rel='stylesheet' id='parent-style-css' href='https://www.miamirealestateguy.com/wp-content/themes/Serene/style.css' type='text/css' media='all'/>
    <link rel='stylesheet' id='serene-style-css' href='https://www.miamirealestateguy.com/wp-content/themes/Serene_child/style.css' type='text/css' media='all'/>

    Once as ID child-style-css and once as ID stylesheet?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Lisa

    (@workingwebsites)

    Have a look in your functions.php file in your child theme. It looks like it’s loading it twice.

    Look for ‘child-style-css’ and ‘serene-style-css’, that should point you in the right direction.

    Hi,

    Check your child theme’s functions.php and remove the line that contains the following:

    get_stylesheet_uri()

    You don’t need to enqueue your child theme’s stylesheet as its already being enqueued by the parent theme ??

    Let me know if you have any questions.

    Best Regards,
    Dustin Falgout
    Elegant Themes

    Thread Starter joyryde

    (@joyryde)

    Hi guys!

    So here is the child theme functions.php:

    <?php
    function et_serene_remove_fonts() {
    	remove_action( 'wp_enqueue_scripts', 'et_serene_load_fonts' );
    }
    add_action( 'init', 'et_serene_remove_fonts' );
    function et_theme_enqueue_styles() {
        wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css' );
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array( 'child-style' ) );
    }
    add_action( 'wp_enqueue_scripts', 'et_theme_enqueue_styles' );

    I’m guessing that it should only be this now?

    <?php
    function et_serene_remove_fonts() {
    	remove_action( 'wp_enqueue_scripts', 'et_serene_load_fonts' );
    }
    add_action( 'init', 'et_serene_remove_fonts' );
    function et_theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array( 'child-style' ) );
    }
    add_action( 'wp_enqueue_scripts', 'et_theme_enqueue_styles' );

    I should delete only this line:

    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css' );

    Thread Starter joyryde

    (@joyryde)

    I should delete only this line:

    wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’ );

    Yes that’s correct.

    ps Dustin, maybe you can help me with this issue too

    Sure I can take a look ??

    Cheers!

    Thread Starter joyryde

    (@joyryde)

    Removing that line destroys the entire site. It removes all styling.

    Sorry, I didn’t notice that you had a dependency set in your call to wp_enqueue_style. Use this code instead:

    <?php
    
    function et_serene_remove_fonts() {
    	remove_action( 'wp_enqueue_scripts', 'et_serene_load_fonts' );
    }
    add_action( 'init', 'et_serene_remove_fonts' );
    
    function et_theme_enqueue_styles() {
        wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'et_theme_enqueue_styles' );

    Thread Starter joyryde

    (@joyryde)

    Thanks Dustin, fixed it!!

    My pleasure ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Serene Stylesheets are being called twice each in my site?’ is closed to new replies.