最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Add class to global $post

programmeradmin1浏览0评论

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)

  1. 暂无评论