Skip Navigation

[Resolved] Change the “Add new” text on post form

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

Problem:
The issue here is that the user wanted to customize their add new text.

Solution:

I would recommend taking a look at the link below.

https://toolset.com/forums/topic/i-want-to-change-the-delete-button-text-for-a-repeating-image-field/#post-362316

This support ticket is created 6 years, 1 month 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 6 replies, has 2 voices.

Last updated by WayneH4064 6 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1191330

Tell us what you are trying to do?
On my post submission form (hidden link; id=207202), I want to change the "Add new" text to "Add another". Ideally i would like to be able to change it to "Add %%whatever-the-label-is%%". For example if I have a field that allow multiple photos to be added, I'd like to have the button read "Add photo", the phone number field to have the button read "Add phone number". To me this seems like it might be desirable to more than just myself and is a logical improvement.

Is there any documentation that you are following?
I've looked at a bunch of posts but none seem to have a solution that works

Is there a similar example that we can see?

What is the link to your site?
hidden link

#1192128

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Wayne,

While you may not be able to have it with "Add %%whatever-the-label-is%%" you should be able to change it to Add another.

We should be able to use JS to change it.

Would you mind providing me with a login to the site so that I can check this for you ?

Thanks,
Shane

#1192129

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Or alternatively you can have a look at the link below
https://toolset.com/documentation/user-guides/styling-cred-forms/#cred-button-filters

#1192257

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Wayne,

Thank you for the login,

I was able to solve the issue by using this code below.

add_filter('toolset_button_add_repetition_text', 'toolset_button_add_repetition_text', 10, 2);
function toolset_button_add_repetition_text($text, $config)
{
    return 'Add New '.$config['title'];
}
#1192266

Hey Shane
That works beautifully and as I requested. But now I realize that there is a plural/non-plural issue on some of the fields. If you visit hidden link (while logged in), you'll see the the "Add new" text for the "Gallery Images" is correctly being re-written as "Add Gallery Image". However, for the Policies and House Rules" it is being rewritten and and maintains the plural instead of rewriting to singular. Hope I've explained that clearly enough.

I've got to take off for a few hours but will be in touch.

Thanks again,
Wayne

#1192640

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Wayne,

I did a little modification to the code and it should now be running fine.

Thanks,
Shane

#1192678

I actually removed the last bit a code as I found I could fix the issue by just manipulating the field name. My issue is resolved now. Thank you!