• happysolicitor

    (@happysolicitor)


    So this has been a known issue with this particular theme for a year and a half and it’s still not resolved. In short, here’s the main issues that contribute to poor behaviour when this is used as a parent theme:

    1. The theme uses get_stylesheet_uri() in the parent theme to load its stylesheet. While this would be the expected practice for a standalone theme, when used as a parent, it causes an issue where we can’t dequeue and re-enqueue the child stylesheet in an appropriate order.

    2. The stylesheet is enqueued without passing a version parameter. This means that unless I manually change the parent’s functions.php file and pass time() as a parameter, I can’t cachebust when behind a CDN.

    The entirety of the issues revolving around the bad enqueueing practice for this theme can be resolved by updating line 138 of functions.php to read wp_enqueue_style( 'style-css', get_template_directory_uri() );

    Why?

    Because this allows us properly override the stylesheet in a child theme, cachebust the stylesheet at will, and when manually altering the enqueue order in a child theme, it’s not loading the child theme’s stylesheet twice.

    As it currently is written, the child theme will load CSS twice because the parent theme is overextending its scope and using the wrong function to pull the stylesheet from the active theme, rather than the parent theme’s directory.

    It’s a simple fix, it conforms to the expected behaviour for parent themes and all around makes things easier for developers using your theme as a parent.

    Am I missing something blatant here? This seems pretty obvious to me.

  • The topic ‘Please Fix Stylesheet Enqueue’ is closed to new replies.