I have a problem that is simple and straight forward, but I have no idea what I'm doing wrong.
The function is simple, I want to add a class inside the Body in the login page of Wordpress, I can do that, but I also want to update the page to generate a random number to complement the class. >
Example: when accessing the page and generating a random class, let's say it is "bg_color_2", when updating the page the value changes to another random number and let's say "bg_color_4".
The function I'm using is this one, but it's not working.
function login_classes( $classes) {
$classes[] = 'bg_color_'; // essa e a class
$value = rand(1,5); // aqui e gerado meu numero aleatório até 5
return $classes, $value; / onde deve retornar os valores que fique "bg_color_4"
}
add_filter( 'login_body_class', 'login_classes' );
I can do it another way, the problem and that I have to edit the wp-login.php of Wordpress and add within the class of the body this function:
bg_color_<?php echo rand(1,5); ?>
And of course this is not an alternative, even because you should never change Wordpress files without running the risk of losing them when you upgrade.