简体   繁体   English

如何将新的 div 添加到 wordpress 管理登录面板

[英]How to add new div to wordpress admin login panel

I would like to somehow insert a new div into the admin login panel.我想以某种方式将一个新的 div 插入管理登录面板。

functions.php函数.php

<?php
add_action( 'login_enqueue_scripts', function () {
    
wp_enqueue_script( 'jquery' );

wp_enqueue_style( 'amereo-login-styles', get_theme_file_uri('login-styles.css'), [], false );
wp_enqueue_script( 'amereo-login-scripts', get_theme_file_uri('login-scripts.js'), [], false, true);
} );

login-styles.css登录样式.css

    #login a {
    height:80px;
    width:80px;
    background-repeat: no-repeat;
    background-image: url("images/login_logo.png");
    }
    
    body.login
    {
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center;
    background-size:cover;
    background-image: url("images/1.png");
    cursor: url('images/cursor.png'), default;
    }

login-scripts.js //empty login-scripts.js //empty

(Most probably I could edit the wp-login.php file only I would like to get this effect using my theme) Is this even possible? (很可能我只能编辑 wp-login.php 文件,我想使用我的主题获得这种效果)这可能吗?

You can use login_init hook for this.您可以为此使用login_init挂钩。

add_action('login_init', function(){
    ?>
        <div>
            Your custom div
        </div>
    <?php

});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM