Support » Plugin: Author Product Review » Improve CSS insertion

  • I had a problem that the plugin was adding its CSS at the very end of the header, so breaking optimisation recommendations, and also overwriting my own modifications in my site custom css.

    The solution to this, and a recommendation for future plugin versions is to comment out line 223:

    //echo '<link type="text/css" rel="stylesheet" href="' . plugins_url( 'author-product-review.css' , __FILE__ ) . '" />' . "\n";

    and add this function to author-product-review.php just after the include:

    function my_scripts() {
    wp_register_style( 'author-product-review', '/wp-content/plugins/author-product-review/author-product-review.css');
    wp_enqueue_style( 'author-product-review' );

    The css will now be correctly added with other scripts near the beginning of the header, before JS.

  • The topic ‘Improve CSS insertion’ is closed to new replies.