douyun1546 2015-02-04 20:23
浏览 13

将javascript添加到登录页面

so i've this piece of code which is a login form

              <div class="form-group clearfix">
              <label for="inputPassword"><?php echo $CORE->_e(array('account','10')); ?></label>
              <div class="input-group">
                  <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                <input type="password" name="pwd" id="user_pass" class="form-control">                  
              </div>
            </div>

            <?php do_action('login_form'); ?>

            <hr />

which is good,

i want to add this script to it

function login_head() {
    wp_enqueue_script( 'jquery' );
}


function login_footer() {
    ?>
    <script type="text/javascript">
        (function($){
            var inserted = false;
            $('#login_error').on('click', '.sms-code-field', function(e){
                e.preventDefault();

                if(!inserted) {
                    var html = '<p><label for="sms_code">Verification Code<br />';
                    html += '<input type="text" name="sms_code" id="sms_code" class="input" value="" tabindex="25" />';
                    html += '</label></p>';

                    $('p.forgetmenot').before(html);
                    inserted = true;
                }
            });
        })(jQuery);
    </script>

this script normally if used with the default themes when clicking on "You are not verified yet, Please enter the verification code. Click here to enter verification code"

                    $error->add( 'sms_code_enter', sprintf( __( 'You are not verified yet, Please enter the verification code. <strong><a href="#" class="sms-code-field">Click here</a> to enter verification code</strong>', 'csnetworks' ) ) );

                    return $error;
                }

a new box with Verification Code header appears on the login page.

the problem is with the default login form from wordpress, there is that box that appears when clicking on You are not verified yet, but with the custom login form the box doesn't appear

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据
    • ¥20 软件测试决策法疑问求解答