P text added to html text

前端 未结 3 1625
栀梦
栀梦 2021-01-19 20:02

I know there are a lot of topics on this, and I\'ve already looked at all them and none of the solutions there apply to me.

I\'ve put a shortcode to run a jscript fo

3条回答
  •  清歌不尽
    2021-01-19 20:32

    Don´t use inline JS - use register_script() and wp_enqueue_script

    function o99_load_my_scripts()  
    {  
        // Register for a plugin:  
        wp_register_script( 'custom-script', plugins_url( '/js/my-custom-script.js', __FILE__ ) );  
        // or  
        // Register for a theme:  
        wp_register_script( 'custom-script', get_template_directory_uri() . '/js/my-custom-script.js' );  
        // then, you can then enqueue the script:  
        wp_enqueue_script( 'custom-script' );  
    }  
    add_action( 'wp_enqueue_scripts', 'o99_load_my_scripts' ); 
    

提交回复
热议问题