Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
login_enqueue_scripts - 登录页面引入脚本和样式 - WordPress钩子 - WordPress动力
当前浏览:首页 / WordPress钩子 / login_enqueue_scripts

do_action( 'login_enqueue_scripts' )

登录页面引入脚本和样式


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "83a93cbba58fcaf30c9a6f90bd9cb328" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "c6e5825e18c4a318cc7e6afd4d06ca14" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "2d55252fc1d8979bc0f45a023733e4d4" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

enqueue 引入js/css

login

scriptmore...


更多信息

login_enqueue_scripts是对登录页面上应用的脚本和样式进行排队引入时使用的正确钩子。尽管名字是这样,但它是同时适用于脚本和样式的,在所有登录和注册相关的界面上。



源码

查看源码 官方文档


更新日志

版本描述
3.1.0开始引入

使用示例

  • 示例1
    function themeslug_enqueue_style() {
    	wp_enqueue_style( 'core', 'style.css', false ); 
    }
    
    function themeslug_enqueue_script() {
    	wp_enqueue_script( 'my-js', 'filename.js', false );
    }
    
    add_action( 'login_enqueue_scripts', 'themeslug_enqueue_style', 10 );
    add_action( 'login_enqueue_scripts', 'themeslug_enqueue_script', 1 );
  • 示例2

    来自Codex

    function themeslug_enqueue_style() {
    	wp_enqueue_style( 'core', 'style.css', false ); 
    }
    
    function themeslug_enqueue_script() {
    	wp_enqueue_script( 'my-js', 'filename.js', false );
    }
    
    add_action( 'login_enqueue_scripts', 'themeslug_enqueue_style', 10 );
    add_action( 'login_enqueue_scripts', 'themeslug_enqueue_script', 1 );