Support » Plugin: Comments Like Dislike » Suggestion for optimization

  • Hi there,

    By default Font Awesome CSS is loaded by the plugin. But what if people already use it in their theme or added it manually? Then it is loaded twice, which makes absolutely no sense. It would be way better to add an option in the settings whether to enqueue or not enqueue the CSS file.

    Same goes for the CSS file of the voting buttons themselves. I myself for example added the CSS to my theme’s CSS file, so I don’t need to load an extra CSS file.

    And lastly, all CSS files and the JS file are loaded on all pages/posts/index/…, no matter if there is a comment form present or not. I suggest, these files are only enqueued, if needed. That reduces the number of requests, is better for performance and page speed tools. (I only load the JS on single.php for example, but the detection of the comment form is of course a much better solution). The JS can also be moved to the footer for faster rendering of the page.

    Just my two cents…

    • This topic was modified 2 years, 5 months ago by jackennils.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Happy Coders


    Hello Jackennils,

    We really appreciate your suggestions and we will try to implement feasible ones one by one in our future updates.

    Regarding loading the CSS and JS files, WP doesn’t provide any option to enqueue in specific page. We can add an option to choose page in the backend and load only in those pages but do you have any better logical solution. How to check the comment form availability? Do you mean to check if it is single.php template and then comments are open?

    Regards WPHC

    Well, I suggested the same thing to the dev of WP Ajaxify Comments. Their script was also loading on all pages and now only loads on pages/posts with comments.

    In my case, I only use comments on the single.php. But others may use comments on pages as well. I don’t know how they did it, but you can look here:

    Maybe if you take a look at their code, you can find out how they do it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggestion for optimization’ is closed to new replies.