Author Product Review
Improve CSS insertion (1 post)

  1. hqarrse3
    Posted 2 years 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' );

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


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Author Product Review
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.