サポート » 使い方全般 » WP-Members ログインウィジェットの項目変更

  • 解決済 aka777

    (@aka777)


    どなたか力を貸して頂きたいです。
    WP-Membersのプラグインを導入し、WP-Members用のログインウィジェットを設定しているのですが「ユーザー名またはメールアドレス」の項目を「ユーザ名」に変更しようとfunctions.phpを以下に書き換えましたが、変更されません。
    コードが間違っているのでしょうか。それともこの部分に関しては変更ができないのでしょうか。

    add_filter( ‘wpmem_default_text’, function( $text ) {

    $text[‘widget_login_username’] = ‘ユーザー名’;

    return $text;
    });`

    【参考】
    https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_default_text/

    ・WordPressバージョン:WordPress 5.1.13
    ・テーマ:AN TCD014

5件の返信を表示中 - 1 - 5件目 (全5件中)
  • Chad Butler

    (@cbutlerjr)

    I am not sure if what you have there is exactly what you are using, but if it is, then you need to remove the whitespace between $ and text. Otherwise, you are not defining the variable $test.

    add_filter ('wpmem_default_text', function ($text) {
        $text ['widget_login_username'] ='username';
        return $text;
    });

    Also, this only changes the widget form label. If you want to change the main body form, you have to target “login_username”.

    And these only affect the forms for WP-Members. If the form is generated from anything else, such as your theme or another plugin, then you have to look at how to customize that form.

    トピック投稿者 aka777

    (@aka777)

    @cbutlerjr
    ありがとうございます!
    ご返答のコードでも変更できませんでした。
    ご指摘頂いたとおりテーマを使用しておりますので、テーマのフォームをカスタマイズする必要がありそうです。
    もう少し調べてみる事にします。ありがとうございました。

    Chad Butler

    (@cbutlerjr)

    Another thing to consider is that if you are using a cache plugin, you usually will need to clear the cache after making any changes.

    トピック投稿者 aka777

    (@aka777)

    @cbutlerjr
    ありがとうございます。
    調べ直してみたところ記述文が間違っておりました。
    以下の記述で書き換えできました。
    ご丁寧に教えて頂き、ありがとうございました。

    function my_sidebar_form_filter( $form ) {
    $form = str_replace( ‘ユーザー名またはメールアドレス’, ‘ユーザー名’, $form );
    return $form;
    }
    add_filter( ‘wpmem_sidebar_form’, ‘my_sidebar_form_filter’ );`

    Chad Butler

    (@cbutlerjr)

    If you are going to do it that way, use wpmem_login_widget_form instead. wpmem_sidebar_form is deprecated as of version 3.3.9. wpmem_login_widget_form works the same way so you only have to change the filter name.

5件の返信を表示中 - 1 - 5件目 (全5件中)
  • トピック「WP-Members ログインウィジェットの項目変更」には新たに返信することはできません。