Add class to global $post

Question

I added this code in order to customize the password protected page. I was able to add classed to most of the elements but I need to style the page title. How can I add a custom class to the $post?

 function my_password_form() {
    global $post;
    $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
    $o = '<form action="' . esc_url( site_url( 'wp-login.php?action=postpass', 'login_post' ) ) . '" method="post" class="formpassword">
    ' . __( "Per visualizzare il contenuto di questa pagina &egrave; necessaria una password" ) . '
    <label for="' . $label . '">' . __( "" ) . ' </label><input name="post_password" id="' . $label . '" class="uk-input password" type="password" size="20" maxlength="20" /><input type="submit" class="uk-button-primary password" name="Submit" value="' . esc_attr__( "Submit" ) . '" />
    </form>
    ';
    return $o;
}
add_filter( 'the_password_form', 'my_password_form' );
0
Matteo 8 months 2020-11-24T11:10:31-05:00 0 Answers 10 views 0

Leave an answer

Browse
Browse