Skip Navigation

[Resolved] front end submission posts with WPML

This support ticket is created 7 years, 2 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
- 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 5 replies, has 2 voices.

Last updated by Luo Yang 7 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#574243
QQ图片20170927115912.png

I am using WMPL+TOOLSET to build a bilingual site, the most important feature is submit forms on front-end and displaying on the posts. I have translated the post layout, cred forms and every custom field and label. it shows up correctly in cred forms, but the custom fields still show original language in posts.
My questions are:
1st, how to automatically translate custom fields in posts, since major contents are select, radio fields and media fields. all fields have been translated or no need to translate.
2nd, how can I use original language slug for bilingual site, because my second language site is Chinese, slugs in chinese can not be identified by some browser, so I just want to keep original English slug to second language site.
Best regards

#574370

Dear Jeffrey,

Q1) how to automatically translate custom fields in posts,

There isn't such a built-in feature within CRED or WPML, I suggest you try with CRED action hook cred_save_data, when user submit the CRED form, use action hook cred_save_data to trigger a PHP function, do these:
1) get the related translated value
https://developer.wordpress.org/reference/functions/get_post_meta/
2) save it into new post
https://developer.wordpress.org/reference/functions/update_post_meta/

More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

Q2) how can I use original language slug for bilingual site
Same as above, you can use CRED action hook cred_save_data to trgger a PHP function, do these
1) Get the post ID of original language
https://wpml.org/wpml-hook/wpml_object_id/
2) get the value of post permalink
https://developer.wordpress.org/reference/functions/get_permalink/
3) Save it into new post:
https://developer.wordpress.org/reference/functions/wp_update_post/

#575855

it is hard work to me? could you please help with it? Thanks 🙂

#575907

It needs custom codes, if you need more assistance for it, please provide a test site with same problem, and fill below "private detail box" with login details, also point out the problem page URL and CRED form URL, where I can edit your PHP codes, I need a live website to test and debug, thanks

#578064

Hi Luo, Thank you so much for you great help. Ihave been very busy recently, to go online, I just want to hold this ticket, and I will send information for you to access my wp account soon after. whenever you see my ticket, please resend the private link to me again. Thanks a lot! 🙂

#578073

As your request, I enabled the "private detail box" again, please also point out the problem page URL and CRED form URL, where I can edit your PHP codes, I need a live website to test and debug, thanks