Skip Navigation

[Resolved] change repeating field "add"" button's text

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. 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 4 replies, has 2 voices.

Last updated by shirlyk 8 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#396931

I am trying to: I would like to replace the .wpt-repadd button's text to something else.

I visited this URL: https://toolset.com/forums/topic/replace-wpt-repdelete-with-image/
that works perfect on the DELETE button's text. but not on the ADD button.

I expected to see: an option to insert my own text string for that button.

thank you 🙂

#397076

Dear shirlyk,

I suggest you use CRED filter hook "toolset_button_add_repetition_text" to change the button text, for example this thread:
https://toolset.com/forums/topic/change-add-new-text-on-multiple-instances/

#397253

Hello Lou,
thanks for the response.
is this solution will change the text in all the cred forms i have?
can i apply this only to one specific cred i want?

in case i want on cred X to write one thing and on cred Y i want to write something else.

thank you!
s

#397429

You can use $cft['id'] to check the it is the specific "Add new" button, for example:

add_filter('toolset_button_add_repetition_text', 'my_add_new_text', 10, 2);
function my_add_new_text($str, $cfg){
	if($cfg[id] == 'cred_form_355_1_wpcf-repeating-field-1'){
		$str = "Add something new";
	}
	return $str;
}

To get the specific button ID, please view the source HTML code of the "Add new" button in front-end, for example:

<input type="button" class="js-wpt-repadd wpt-repadd" data-wpt-type="textfield" data-wpt-id="cred_form_355_1_wpcf-repeating-field-1" value="Add something new">

The attribute "data-wpt-id" is the button ID.

#399280

great! it works 🙂
thank you!

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.