wordpresspluginsfouc

How can I permanently fix an issue caused by a wordpress plugin?


I am using the plugin Photo Gallery on my WP site and have a CSS issue with it. Before the gallery is displayed correctly, it is displayed for a split second in a different way. From what I found out, this is apparently a "FOUC" (Flash of unstyled content) and caused by the plugin's CSS file being loaded too late.

Now I was able to fix it by adding a CSS class (.invisible) to the whole gallery in the plugins php code and setting that class in the wordpress style.css to "display: none;". In my themes JS I then check if there is a photo gallery on the page and once the according CSS file is loaded, I remove the .invisible class from the gallery, so it is displayed correctly.

I am aware that this is not really a good solution, as the next plugin update will break it.

So my question is: What is a better way to fix an issue like this?


Solution

  • Probably the best bet would be to reach out in the support forums and let the plugin authors know that there is a problem. You already have a working fix for that problem so don't hestitate to show them your solution (but i dont think that hiding the slider is a good solution).

    All plugins in the WordPress plugin repository have a support forum on wordpress.org … many plugins also have own websites with some kind of support mechanism (forum, contact form …).

    Another solution would be to place the code that fixes the plugin not in the plugin folder itself but in you theme/child theme or a own plugin …