I am relatively new to WordPress code and would like to enhance my login page with https://animate.style/ or other jQuery code. Do you think there are any security concerns in doing this? Thanks for your support!
-
Does this answer your question? Wordpress admin stylesheet– AmiritionCommented Apr 4, 2021 at 5:01
-
Are you asking how to do it? Or are you asking if this is secure? Note that the site you llnked to is not a jQuery plugin or javascript, it is pure CSS ( I use it on my own site )– Tom J Nowell ♦Commented Apr 4, 2021 at 10:54
1 Answer
By using the following code in your functions.php
file, I believe you can achieve the required result.
function login_stylesheets() {
wp_register_style( 'animate_css', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css' );
wp_register_style( 'my_login_stylesheet', get_template_directory_uri() . '/LINK/TO/YOUR/CSS/FILE.css' );
wp_enqueue_style( 'animate_css' );
wp_enqueue_style( 'my_login_stylesheet' );
}
add_action( 'login_head', 'login_stylesheets' );
The above wp_register_style
function is derived from the WordPress Codex. From here it is just a matter of editing the my_login_stylesheet
CSS file and customising to your hearts content! (Be sure to use this link for referencing login CSS classes. Also make sure to change /LINK/TO/YOUR/CSS/FILE.css
to the directory of your actual CSS file.)
I hope that answers your question!
-
Thanks for your answer and thanks for the code. but i was more concerned about security. could jquery on the wp-login.php cause problems, compromise the security of the whole site? Commented Apr 4, 2021 at 8:46
-
I believe if you use the correct WordPress functions provided, you should be fine!– Anake.meCommented Apr 4, 2021 at 9:00
-
Also, animate.style is simply a CSS file, so jQuery is not a problem here.– Anake.meCommented Apr 4, 2021 at 9:01
-
@robinex animate.css has nothing to do with jQuery or javascript, it's pure CSS, it's a stylesheet that adds helper classes for CSS animations– Tom J Nowell ♦Commented Apr 4, 2021 at 10:55