Skip Navigation

[Resolved] Change “Enter your internal title for the item” placeholder in for RFG

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to change the placeholder text shown when adding a Repeating Field Group, "Enter your internal title for the item."

Solution:
Use the gettext filter to modify this text with PHP:

add_filter( 'gettext', 'change_rfg_internal_title', 20, 3 );
/**
 * Change RFG internal title text
 *
 * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
 */
function change_rfg_internal_title( $translated_text, $text, $domain ) {
 
    if ( is_admin() ) {
 
        switch ( $translated_text ) {
 
            case 'Enter your internal title for the item.' :
 
                $translated_text = __( 'Put your plain text message here' );
                break;
        }
 
    }
 
    return $translated_text;
}
This support ticket is created 6 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by webD-3 6 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1083937

I am displaying the value of input.js-rg-title-input on the front end of my site. How can I change the placeholder text that says "Enter your internal title for the item" so that the user knows it's not just for internal purposes?

#1084027

Hi, if you're using WPML with String Translation, you can modify the text there. If not, you can add this custom code to your child theme's functions.php file:

add_filter( 'gettext', 'change_rfg_internal_title', 20, 3 );
/**
 * Change RFG internal title text
 *
 * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
 */
function change_rfg_internal_title( $translated_text, $text, $domain ) {

    if ( is_admin() ) {

        switch ( $translated_text ) {

            case 'Enter your internal title for the item.' :

                $translated_text = __( 'Put your plain text message here' );
                break;
        }

    }

    return $translated_text;
}

Change Put your plain text message here to be the plain-text phrase you would like to display instead, surrounded by quotes.

#1084063

Christian, thank you very much!

I took the function one step further and added another if statement so that I could use the translated text on a specific post type only:

if ( get_post_type( get_the_ID() ) == 'news' )

This is exactly what I was seeking and I thank you (as always) for the prompt and accurate reply.