Skip Navigation

[Gelöst] change placeholder in Front-End Forms for Connecting Posts

This support ticket is created vor 4 Jahren, 7 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 9 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von Dido vor 4 Jahren, 6 Monaten.

Assistiert von: Shane.

Author
Artikel
#1594377
place.JPG

Hi,

How can I change this placeholder?

[cred-relationship-form-container]
<div class="form-group">
<label>Kies je producten</label>
[cred-relationship-role role='parent' placeholder='Product']
</div>
<div class="form-group">
<label>Partners</label>
[cred-relationship-role role='child' author='$current']
</div>
[cred-form-feedback field='feedback' name='feedback']
[cred-form-submit field='submit' name='submit']
[cred-form-cancel field='cancel' name='cancel']
[/cred-relationship-form-container]

#1595709

Hi, if you're not using WPML you can filter the getText function to supply a different translated string:

add_filter( 'gettext', 'zoeken_text_func', 20, 3 );
/**
 * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
 */
function zoeken_text_func( $translated_text, $text, $domain ) {
    if($text == 'Search for a post' && $domain == ['wp-cred']){
      $translated_text = "Custom text here";
    }
    return $translated_text;
}
#1603793

Hi Christian,

I added the code, but I don't see any difference. Is "Custom text here" the only thing I need to edit?

#1604793

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Dido,

Christian is currently unavailable today but he will be back tomorrow to continue assisting with this.

Thanks,
Shane

#1614499

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Dido,

Is your site's original language English or is it a translation ?

What is the default language of the site? You may need to replace this "Search for a post" with the default text that is currently on your post and replace "Custom text here" with the text you want to display instead.

Please try this and let me know the results.

Thanks,
Shane

#1614943

hi Shane,

My default language is Dutch. I tried this:

add_filter( 'gettext', 'zoeken_text_func', 20, 3 );
/**
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function zoeken_text_func( $translated_text, $text, $domain ) {
if($text == 'Zoeken naar een bericht' && $domain == ['wp-cred']){
$translated_text = "Zoek een product";
}
return $translated_text;
}

It is not working yet.

By the way, Can you review the code?
I added it to the PHP inserter plugin. I could not reach the functions.php before.
Now I have access to the functions, but when I past the code, an error occured on the website.
So maybe there is a problem with the snippet?

PS In a view, you can add a custom text in a dropdown.
default_label="Zoek een product"
Why is this not possible in a cred form?

#1617217

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Dido,

Would you mind allowing me to have admin access to the website so that I can check on these issues for you ?

CRED is not able to natively do this so it has to be overwritten with code.

I would like to see what is causing these errors.

Thanks,
Shane

#1623339

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Dido,

I'm still looking into this for you, however it will take some time as our forums are extremely loaded at the moment so i'm asking for some patience.

We may be able to resolve this with some Javascript but I'm currently running some tests to see.

Thanks,
Shane

#1623341

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Dido,

You should be able to add this custom jQuery below to your site to trigger the text change.

jQuery( document ).ready(function() {
jQuery(".toolset_select2-selection__placeholder").html('my test')
});

Please let me know if this helps for you.

Thanks,
Shane

#1623349

My issue is resolved now. Thank you!