WordPress.org

Forums

Author Product Review
Improve CSS insertion (1 post)

  1. hqarrse3
    Member
    Posted 1 year ago #

    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' );
    }
    add_action('wp_enqueue_scripts','my_scripts');

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

    http://wordpress.org/plugins/author-product-review/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.