Support » Plugin: Advanced Custom Fields: Font Awesome Field » troubles since it is using the same handle as elementor

  • hy there,
    first of all thank you for this great plugin, which we use on many client sites.

    we use elementor page builder pretty often too. now i had to dive deeper into the topic of css handles and i found out that your plugin and elementor both use “font-awesome” as css handle. i can see that elementor did this only for the fa-v4 css and no longer for fa-v5.

    anyway, this can cause troubles because the plugins override themselfes with this handle and it can happen that elementors v4 css is loaded my mistake instead of your css.

    i found a way to dequeue everything and enqueue the styles with the url from your plugin, which i think is a safe workaround. but maybe you would think of changing the handle for your css to have some prefix added? i know it is tricky, since users may already have such workarounds published but it could work with some transition like it was done from v4 to v5. or just provide a filter for developers to change the css-handle?

    here is my workaround:

    //to not load styles with font awesome acf plugin
    add_filter('ACFFA_always_enqueue_fa', '__return_false');
    //to re-enqueue styles after they were dequeued from elementor
    function my_requeue_fa(){
    	wp_dequeue_style('font-awesome'); //could be font awesome acf plugin or elementor v4-fa
    	wp_enqueue_style( 'my-fa-styles', apply_filters( 'ACFFA_get_fa_url', '' ) ); //now enqueue the correct style
    }
    add_action('wp_enqueue_scripts', 'my_requeue_fa', PHP_INT_MAX);

    i hope you understand my concerns 😉
    matt

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Keys

    (@mattkeys)

    Sorry I read this comment back when you posted it and thought I had responded. I think your suggestion to use a filter here seems reasonable and I will try to incorporate that into the next update of this plugin.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.