• zzhovo

    (@zzhovo)


    There’s a check role_can_impersonate() before drawing the menu, so the same check can be used to avoid loading scripts.

    function tikemp_scripts(){
    	if( role_can_impersonate( ) ){
    		wp_enqueue_script('tikemp_search_scroll', plugins_url( '/js/jquery.nicescroll.min.js', __FILE__ ), array( 'jquery' ),'1.1',true);
    		wp_enqueue_script('tikemp_script', plugins_url( '/js/script.js', __FILE__ ), array( 'jquery','tikemp_search_scroll' ),'1.2',true);
    	}
    }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Enqueue scripts on demand’ is closed to new replies.