Open extra topbar

How to customise text labels on UI forms?

I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

How to customise text labels on UI forms?

dashed-slug.net Forums General discussion How to customise text labels on UI forms?

Tagged: , , , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #3068
    jkhaui
    Participant

    Hey Alex,

    Really admire your work. Great stuff. Now as you’ll be able to see, I’m not a coder and have no idea what I’m doing. I’m trying to change the text on wallets_ui_* fields but not sure what I’m doing wrong. E.g. of my code:

    <?php echo apply_filters( ‘wallets_ui_text_comment’, esc_html__( ‘Comment’, ‘wallets-front’ ) ); ?>

    add_filter( ‘wallets_ui_text_comment’ , ‘change_text’);
    function change_text($comment) {
    $comment = str_replace ( “comment” , “leave a message” );
    return $comment;
    }

    So in that case, I’m trying to change the label “comment” to “leave a message”. Also, where do I add this code? I put it in functions.php of my child theme and all I get is white screen of death of 500 error.

    Cheers

    #3071
    alexg
    Keymaster

    Hello,

    It looks like you are 90% there.

    I believe the problem is that you are first trying to bind the function and then you define that function. Also, you don’t need str_replace. Try something like:

    function change_text($comment) {
      $comment = "leave a message";
      return $comment;
    }
    
    add_filter( 'wallets_ui_text_comment' , 'change_text');

    The reason you just get a blank page and not an error message is that you have not enabled errors. If you try the above and it still does not work, follow the instructions here: https://codex.wordpress.org/Debugging_in_WordPress to enable logging.

    Let me know if you still have problems with this.

    kind regards

    #3079
    jkhaui
    Participant

    You are a legend, worked perfectly. I have absolutely no idea how you did all this by yourself, but please don’t stop. 😀

    #3081
    alexg
    Keymaster

    Haha thanks.

    It’s not magic. Simply a combination of good project management skills and lots of caffeine.

    Glad it worked for you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.