Skip to:
Content
Pages
Categories
Search
Top
Bottom

Customize Text or change language


  • millerguide
    Participant

    @millerguide

    How can I change the text of the forum, for example, change “Create New Topic” to something of my choosing? Alternately, is there a way to change everything to simplified Chinese? Thank you.

Viewing 16 replies - 1 through 16 (of 16 total)

  • Robin W
    Moderator

    @robin-w


    millerguide
    Participant

    @millerguide

    Thank you, Robin W.


    millerguide
    Participant

    @millerguide

    Robin W., after reading that, I think I should explain my problem better. I do not want to change my entire WordPress site’s language. I really just want the ability to customize the text on bbpress, such as “Create New Topic”. I want the text to be both in Chinese and in English. Is there a way to manually do that? Thank you.


    Robin W
    Moderator

    @robin-w

    Put the following in your functions file

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'old text' ) {
    	$translated_text = 'new text';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    

    you can put in multiple lines eg

    if ( $translated_text == 'old text1' ) {
    	$translated_text = 'new text1';
    	}
    if ( $translated_text == 'old text2' ) {
    	$translated_text = 'new text2';
    	}
    

    Functions files and child themes – explained !


    millerguide
    Participant

    @millerguide

    Thank you. How do I specify which text I want to change?


    Robin W
    Moderator

    @robin-w

    so if you wanted to change ‘Create New Topic’ to ‘hello mother’ you would do

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'Create New Topic' ) {
    	$translated_text = 'hello mother';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    

    millerguide
    Participant

    @millerguide

    Ok thanks!


    andrew55
    Participant

    @andrew55

    This is exactly what we need. But when I use this function…

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'Subscriber' ) {
    	$translated_text = 'Member';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );

    …it doesn’t change “Subscriber” to “Member” in profile area or anywhere else.

    Any suggestions on what I can do to get this working?

    Thanks for any help.


    Robin W
    Moderator

    @robin-w

    Subscriber is normally a wordpress role and probably isn’t viewed as ‘text’, it will be taken from a function.

    are yours showing on the forum pages?


    andrew55
    Participant

    @andrew55

    Ok, I see now.

    Yes, it’s a role we are trying to change. We are doing some whacky things with roles. On frontend of bbPress, sometimes we display bbPress roles and sometimes standard WordPress roles.

    I was looking for a method to change how roles are displayed on frontend, without changing the actual name of the role in the database.

    For example, instead of “Participant,” is shows as “New Member”

    Or, instead of “Subscriber,” is shows as “Student”

    Maybe there are different methods to accomplish this for standard WordPress roles and bbPress roles?

    Thanks for any suggestions.


    Robin W
    Moderator

    @robin-w

    ok, for bbpress roles, then my style pack plugin will let you change role names (and a whole lot more)

    bbp style pack

    go to settings>bbp style pack>forum roles


    Robin W
    Moderator

    @robin-w

    if you need something bespoke, email me


    andrew55
    Participant

    @andrew55

    Robin – That’s a powerful plugin. I’ve had it installed for some time. Should be part of bbPress core!

    In plugin, I see where you can change names of roles. This is helpful, but many of our roles are WP roles and custom roles (which I don’t see listed in plugin).

    Any other suggestion on how to change the name of a WP or custom role (just what displays on front-end)?

    For example, if I have a custom role “unsubscribed,” how can I change this to “Inactive”

    Thanks for any help.


    Robin W
    Moderator

    @robin-w

    without knowing how you are currently displaying them (what functions) then hard to say. I can probably do something if I know how it is done currently


    andrew55
    Participant

    @andrew55

    I found this plugin which seems to do the job:

    Real-Time Find and Replace


    Robin W
    Moderator

    @robin-w

    great !!

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar