Stylesheets not loaded
-
Hi I come with an issue + a possible solution.
As I have seen your plugin moves the forms stylesheet to uploads folder manually. This is not a good practice as you need to use WP functions to upload files to the uploads folder. Think that not everyone uses its own uploads folder but third-party services to store all the files.
That said, I’ve also seen that when the stylesheet is missing you load the styles using AJAX. This causes issues randomly as the styles are not always loaded so I have a solution for that.
1. I avoid to load the stylesheet in uploads folder with this hook:
add_filter( 'get_frm_stylesheet', 'formidable_hooks_get_frm_stylesheet', 500 ); function formidable_hooks_get_frm_stylesheet( $stylesheet ) { if ( isset( $stylesheet['formidable'] ) ) { $stylesheet['formidable'] = add_query_arg( 'load_frmpro_css', 'true', site_url() ); } return $stylesheet; }
2. I avoid using AJAX for the styles:
add_action( 'plugins_loaded', 'formidable_hooks_load_custom_stylesheet' ); function formidable_hooks_load_custom_stylesheet() { if ( isset( $_GET['load_frmpro_css'] ) && $_GET['load_frmpro_css'] === 'true' && class_exists( 'FrmProAppController' ) ) { FrmProAppController::load_css(); } }
I hope this helps to improve the plguin.
Thanks.
- The topic ‘Stylesheets not loaded’ is closed to new replies.