Skip Navigation

[Resolved] Changing some default text

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

Problem:

I am trying to:

1) Specific fields in the post relationship table

2) hide the text "Post Relationship" in admin side

Solution:

1) It is a built-in feature within Types plugin: choose fields that you want to display in the post relationship table, for example:

Edit the parent post type "My Timeline", in section "Children Post Types", find post type "Educational institution", click link "Select fields", enable option "Specific fields", there you can specific the fields you want to display.

2) I suggest you try with filter hook "gettext" to change it as what you want, for example, add below codes into your theme/functions.php:

add_filter('gettext', 'my_func3', 10, 3);
function my_func3($translated_text, $text, $domain){
    if($text == 'Post Relationship' && $domain == 'wpcf'){
        $translated_text = ' '; // here you can change the text.
    }
    return $translated_text;
}

Relevant Documentation:

https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext

This support ticket is created 6 years, 8 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.

Our next available supporter will start replying to tickets in about 2.36 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by davoodD-2 6 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#624355
binary view 2018-03-12 at 12.35.09 PM.png

I am trying to change default text...
I found code similar to this in a different support thread here on toolset's support forum:

function wpb_change_title_text( $placeholder ){
global $typenow;
switch ( $typenow ) {
case 'timeline':
echo "<script>jQuery(document).ready(function(){jQuery( '#title-prompt-text' ).html('Enter your name here' );});</script>";
break;
case 'post':
$placeholder = __( 'Enter post title' );
break;
default: break;

}
return $placeholder;
}

add_filter( 'enter_title_here', 'wpb_change_title_text', 11 );

This code worked perfectly..

Now I a trying to make some changes to the post relationships area on the "Timeline" post type within my site. Please refer to my attached screenshot to see the three things I am trying to change.

Thank you in advance.

Sincerely,
Davood Denavi

#624484

Dear Davood,

It is a built-in feature within Types plugin: choose fields that you want to display in the field table, for example:
Edit the parent post type "My Timeline", in section "Children Post Types", find post type "Educational institution", click link "Select fields", enable option "Specific fields", there you can specific the fields you want to display,

#624633

Please review my screenshot again.
I need to hide a column and change titles.

The instructions you gave me do not do accomplish what I am trying to do.

#624636

My mistake. I just looked again and it does do most of what I asked about. However, I still need to remove the title "Post Relationship" is there a way I can do that?

#624796

I suggest you try with filter hook "gettext" to change it as what you want, for example, add below codes into your theme/functions.php:


add_filter('gettext', 'my_func3', 10, 3);
function my_func3($translated_text, $text, $domain){
	if($text == 'Post Relationship' && $domain == 'wpcf'){
		$translated_text = ''; // here you can change the text.
	}
	return $translated_text;
}

More help:
https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext

#624824

The code you provided seems to hide the section all together not only the title where it says "Post relationship"

#624826

Nevermind.. Adding a space to this line
$translated_text = ''; // here you can change the text.
like this
$translated_text = ' '; // here you can change the text.

solved my issues!