• Hi, what’s is $handle name of plugin?
    Despite the fact that q2w3 supports defer/async load, my console.log show error of not loaded jqury for q2w3. So, i want to make it wait for jquery library with forcing defer in functions:

    function namespace_async_scripts( $tag, $handle ) {
        // nothing done, q2w3-widget-fixed might not be correct name
        if ( 'q2w3-widget-fixed' !== $handle ) { 
            return $tag;
        }
      if(is_front_page()){ return $tag;}
      else {return str_replace( ' src', ' defer src', $tag );}
    }
    add_filter( 'script_loader_tag', 'namespace_async_scripts', 10, 2 );

    There are string wp_enqueue_script(self::ID, plugin_dir_url( __FILE__ ) . 'js/q2w3-fixed-widget.min.js', array('jquery'), self::VERSION, true); , but I don’t get out from it what handle name is?

Viewing 1 replies (of 1 total)
  • Plugin Contributor Max Bond

    (@max-bond)

    Hi!
    The handle name is self::ID which is a constant in q2w3_fixed_widget class.
    Its value – ‘q2w3_fixed_widget’. Or you can access it outside of the class: q2w3_fixed_widget::ID

Viewing 1 replies (of 1 total)
  • The topic ‘Async load and $Handle name’ is closed to new replies.