Wordpress에서 비밀번호로 보호 된 게시물을 스타일링 할 수있는 방법이 있습니까? 게다가 나는이 외부의 어떤 사용자 지정 필드도 보호 할 수없는 것처럼 보일뿐입니다.스타일 워드 프레스 보호 게시물
편집 - 플러그인을 사용하지 않도록 노력 가능한 경우
Wordpress에서 비밀번호로 보호 된 게시물을 스타일링 할 수있는 방법이 있습니까? 게다가 나는이 외부의 어떤 사용자 지정 필드도 보호 할 수없는 것처럼 보일뿐입니다.스타일 워드 프레스 보호 게시물
편집 - 플러그인을 사용하지 않도록 노력 가능한 경우
을 수행하기위한 보호 포스트 Personalizer 플러그인을 사용 -종료.
A) CSS :
당신의 테마처럼 post_class()
기능을 사용하는 경우 : 다음이 생성됩니다
<article <?php post_class(); ?>>...</article>
: 암호로 보호 게시물에 대한
<article class="... post-password-required ...">...</article>
. 스타일 시트에
.post-password-required {
background-color: #eee;
}
:
그래서 당신은 단순히 이러한 게시물을 타겟팅 할 수 있습니다.B) 형태 :
add_action('the_password_form', 'rob_the_password_form');
function rob_the_password_form($output)
{
$before = ' Before '; // Modify this to your needs!
$after = ' After '; // Modify this to your needs!
return $before . $output . $after;
}
II) 당신이 원하는 경우 암호 양식에 텍스트를 추가하려면
내가) 다음 사용할 수 있습니다 HTML 양식을 직접 수정하면 다음과 같이 재정의 할 수 있습니다.
add_filter('the_password_form', 'rob_override_the_password_form');
function rob_override_the_password_form($form = '') {
global $post;
$label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
$form = '<form action="' . esc_url(site_url('wp-login.php?action=postpass', 'login_post')) . '" method="post">
' . __("To view this protected post, enter the password below:") . '
<label for="' . $label . '">' . __("Password:") . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" maxlength="20" /><input type="submit" name="Submit" value="' . esc_attr__("Submit") . '" />
</form>
';
return $form;
}
여기서는 Codex의 예를 기반으로합니다. 기본 양식과 동일한 양식을 사용합니다.
C) 제목 :
기본 보호 변경하려면 : 제목 접두사, 당신은 사용할 수 있습니다
add_filter('protected_title_format', 'rob_protected_title_format');
function rob_protected_title_format($format)
{
$format = __(' Members only! %s '); // Modify this to your needs!
return $format;
}
는 희망이 당신의 보호 게시물의 스타일을하는 데 도움이 될 것입니다.
할 수 있습니다 난 당신이 전면에 암호로 보호 된 게시물 스타일링 의미 가정 트릭 https://wordpress.org/plugins/protected-post-personalizer/
다음 오류가 발생하여 함수가 올바르게 작동하지 않는 것 같습니다. 구문 분석 오류 : 예기치 않은 T_FUNCTION in .../wp-content/themes/2015/functions.php (4 행) – Rob
PHP가 5.3 이상인 것으로 가정했습니다 ... 이전 버전을 업데이트하도록하겠습니다 ... 지금 확인하십시오. – birgire
도착하고 있습니다.게시물 페이지에서 오류가 발생하지 않지만 다른 페이지에서이 오류가 발생합니다. 경고 : 헤더 정보를 수정할 수 없습니다 - 이미 보낸 헤더 (출력은 .../beta/wp-content/themes/2015/functions.php : 3에서 시작되었습니다.)) in /.../beta/wp-includes/pluggable.php on line 1172 – Rob