返信先: パスワード入力ページのカスタマイズが反応しない

#2259
架那
ゲスト

お忙しい中、ご返答頂きありがとうございます。

色々とトライ&エラーした際のログは残っておらず、

最終版になりますが、function.phpに記載している全ソースを下記へ記載致します。

またご紹介頂きましたトピックスも拝読致しました。

今回は作品・投稿ページではなく、固定ページにパスワードをかけたいと考えております。

個別で作品・投稿ページにパスワードをかける際は、抜粋文も活用させて頂きます。

 

 

<?php
// 子テーマのスタイルシートを有効にする
function canvas_scripts_and_styles() {
wp_register_style( ‘canvas-stylesheet’, get_stylesheet_directory_uri() . ‘/style.css’, array(), ”, ‘all’ );
wp_enqueue_style( ‘canvas-stylesheet’ );
}
add_action( ‘wp_enqueue_scripts’, ‘canvas_scripts_and_styles’, 1000 );

// PHPを追記する場合はここより下に書いてください。
add_filter(‘the_content’, ‘wpautop_filter’, 9);
function wpautop_filter($content) {
global $post;
$remove_filter = false;

//投稿ページ以外の自動整形を無効にしたければ
if (!is_single()){
$remove_filter = true;
}
if ( $remove_filter ) {
remove_filter(‘the_content’, ‘wpautop’);
remove_filter(‘the_excerpt’, ‘wpautop’);
}

return $content;
}

// パスワード保護ページカスタマイズ
add_filter(‘protected_title_format’, ‘remove_protected’);
function remove_protected($title) {
return ‘%s’;
}

function my_password_form() {
return

<div class=”col-12 margin-top”>
<h2 id=”mail”>mail</h2>
<p class=”margin-bottom”>伝えしたパスワードを入力のうえ送信ボタンを押してください。</p>
<form action=”‘ . home_url() . ‘/wp-login.php?action=postpass” method=”post”>
<p><label for=”pwbox-130″>パスワード
<input name=”post_password” id=”pwbox-130″ type=”text” size=”20″></label>
<input type=”submit” name=”Submit” value=”送信”></p>
</form>></div></div>’;
}
add_filter(‘the_password_form’, ‘my_password_form’);