【日本語に変換】ワードプレスでパスワード保護を記事の途中に置く方法 プラグイン「Passster」

ワードプレスの記事の途中にパスワード保護を置く方法をご紹介いたします。 今回はプラグインを使用、改変していきます。 使用するプラグインは「Passster」です。 インストールまではほかのサイトでも紹介されているので割愛します。   プラグインを有効にし、 パスワードをかけたい箇所にショートコードを入力します。 [passsterr password=”任意のパス”]内容[/passster]   そうするとパワードを入力する箇所と認証のボタンが出てきます。
英語になっていますね。
こちらを日本語に変換していきます。    
目次

「Passster」を日本語

「ドメイン/wp-content/plugin/content-protector/src/admin/class-ps-customizer.php」

タイトル部分から「Protected Area」
93行目
/* instructions headline */
		$wp_customize->add_setting( 'passster_form_instructions_headline', array(
			'default' => __( 'Protected Area', 'content-protector' ),
		) );
 
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
/* instructions headline */
		$wp_customize->add_setting( 'passster_form_instructions_headline', array(
			'default' => __( 'パスワードで保護しています。', 'content-protector' ),
		) );
 

2段目「This content is password-protected. Please verify with a password to unlock the content.」
153行目
/* instructions text */
		$wp_customize->add_setting( 'passster_form_instructions_text', array(
			'default' => __( 'This content is password-protected. Please verify with a password to unlock the content.', 'content-protector' ),
		) );
 
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
 
/* instructions text */
		$wp_customize->add_setting( 'passster_form_instructions_text', array(
			'default' => __( '下の部分パスワードを入力してくだい。', 'content-protector' ),
		) );

   

入力箇所
142行目
/* placeholder text */
		$wp_customize->add_setting( 'passster_form_instructions_placeholder', array(
			'default' => __( 'パスワードを入力', 'content-protector' ),
		) );
エラーメッセージ 2か所
221行目
/* error message text */
		$wp_customize->add_setting( 'passster_form_error_message_text', array(
			'default' => __( '認証パスワードが違います。', 'content-protector' ),
		) );
 

「ドメイン/wp-content/plugin/content-protector/src/admin/class-ps-shortcode.php」

38行目あたり
/* user input */
        $output = $content;
        $wrong_password = apply_filters( 'passster_error_message', '' . get_theme_mod( 'passster_form_error_message_text', __( '認証パスワードが違います。もう一度お試しください。', 'content-protector' ) ) . '' );
        /* api */
   

「ドメイン/wp-content/plugin/content-protector/src/admin/content-protector/src/class-ps-form.php」

コチラも変更 2か所 認証、パスワード
29行目あたり
'[PASSSTER_BUTTON_LABEL]'      => get_theme_mod( 'passster_form_button_label', __( '認証', 'content-protector' ) ),
'[PASSSTER_PLACEHOLDER]'       => get_theme_mod( 'passster_form_instructions_placeholder', __( 'パスワードを入力', 'content-protector' ) ),
   

どこで紐づいているか分からないので、全て変更をしたほうがいいと思います。
実際変更して稼働をさせていますが、今のところ問題ありませんので、日本語に変更したい場合は参考にしてください!
よかったらシェアしてね!
  • URLをコピーしました!
スゴヨクン
この記事の執筆者
スゴヨクン

成果主義Webマーケター見習い。
SEOから広告運用、アクセス解析まで「売れる仕組みづくり」を魔法のように研究中。
難しい用語もやさしく噛み砕いてお届けします。
「スゴくヨクなる」ヒントを、今日もあなたに。

株式会社スゴヨク 川上晋平
この記事の監修者
川上 晋平

株式会社スゴヨクにてマーケティング戦略の立案から実行までを統括。中小企業やスタートアップ向けにWeb広告運用、LP制作、SEO対策など幅広い支援を行っており、これまでに100社以上のデジタル施策をサポート。現場の視点とデータに基づいた分析力に定評があり、確かな実績と最新の知見に基づいた監修を行っています。
■資格:
Google アナリティクス認定資格
Google 広告の検索広告認定資格
Google 広告「ディスプレイ広告」認定資格


CONTACT US

CONTACT US お問い合わせ・ご相談

お見積り・ホームページ制作・運用、広告に関するご質問まで、
どんなことでもお気軽にご相談ください。
日・祝日・休業日以外は24時間以内に返信いたします。

目次