- This topic has 3 replies, 1 voice, and was last updated 1 year, 7 months ago by Mary Evans.
- January 16, 2020 at 1:20 am #905313Ryan LabelleParticipant
I found an issue that is preventing the use of shortcodes on translated pages within WPML. It works for pages that do not require Accommodation ID parameter but not when it is used.
works well on a page using the default language, but crashes when used on a translated page.
I setup a sample site that you can access:
Homepage uses shortcode [mphb_availability_calendar id=21], as you can see from the calendar displayed. However, it’s missing on the translated page (French) https://bluehost.themovation.com/?lang=fr
Not only is it missing from the translated page, but it produces a JS error.
mphb.min.js?ver=3.7.2:1 Uncaught TypeError: this.roomTypeData.fillDateData is not a function.
- WP 5.3.2
- Hotel Booking 3.7.2
- WPML Multilingual CMS 4.3.6
- WPML String Translation 3.0.6
- WPML Translation Management 2.9.4
- Default Twenty Twenty Theme
If you need access to the site, please let me know. I set this up so you can access and debug.
Please let me know if you would like me to create a ticket.
January 20, 2020 at 4:37 pm #907049SteveKeymaster
- This topic was modified 1 year, 9 months ago by Ryan Labelle.
Try to change the ID in shortcode on the translated page (French) from 21 to 33.
Let me know if it helps.January 29, 2020 at 7:51 pm #911409Ryan LabelleParticipant
Thanks. This works.
One thing to mention for others searching for a solution is that when using the WPML Translation Editor which looks like this:
The shortcode might not show up for translation (switching the ID in the shortcode) as Steve recommends. It did not show up for me the first time because I was using a Gutenberg Shortcode Block. I guess they don’t automatically provide translation for that block type. To resolve, I used a paragraph block and put the shortcode in there, that allowed the shortcode to be translated for the other languages.
If you don’t use the WPML translation editor (IE: You’ve duplicated your pages via WPML), then you should have access to the shortcode to translate already.
Also, ID 33 is just the ID of the translated Accommodation Type. 🙂
Thanks. Resolved. I hope this helps others.March 11, 2020 at 2:29 pm #928968Mary EvansParticipant
Thank you for sharing your experience. Here is also an article on how to translate Hotel Booking with WPML that might be useful, in order to make sure you`ve translated everything appropriately.
- You must be logged in to reply to this topic.