Modify wp-login.php content

0
Hello, I am creating a plugin that changes the layout of the Wordpress login screen (located in wp-login.php ), but besides changing the style of the page (which I already have) , I wanted to be able to add HTML elements in it, but without directly editing the wp-login.php .

Is there any way I can redirect the reading of the original file to the one I created inside the plugin?

Thank you in advance.

    
asked by anonymous 20.12.2017 / 19:59

2 answers

0

A "simple" way to do this is by redirecting the login to a custom page, and there you make the modifications you need.

Search in codex wp_login_form() .

This article can also give you a light

    
28.12.2017 / 14:34
0

Another solution would be to use your child's functions.php to insert these elements dynamically. Example:

function my_custom_login() {
    echo '<script>

    document.addEventListener("DOMContentLoaded", function(event) {

    // Your code to run since DOM is loaded and ready
    document.getElementById(\'loginform\').insertAdjacentHTML(\'beforebegin\',
        \'<span class="asterisk">*</span>\');

    });

</script>';
}
add_action('login_head', 'my_custom_login');
    
28.12.2017 / 15:52