-
AuthorPosts
-
February 28, 2021 at 10:41 am #1284216
Hey Enfold,
My current build is for a hotel, but their booking platform is hosted on another platform. This requires the date picker to be set on our website, and then onClick they are re-directed to the booking page.
When I first enter the code into a code block it works, but then if the page is updated t stops working – in particular the script is still there, but the onclick link action is removed – I’m assuming it is being stripped out by the ALB page builder? As the client will be managing updates I need to find a permanent solution that does not involve re-adding the code each time.
I’ve seen some options on the forum where the code sits in functions instead, and is pulled in a different way. Could this work here? There are however 28 different versions of this code throughout the website, with the only difference between each one being the ‘window.open’ section depending on which page (room) or language it is being sent to.
The site has gone live without this, but find example codes and a mock-up page in private. This does not seem to be a plugin issue.
Much appreciated.
March 2, 2021 at 7:31 pm #1284859Hello?
March 3, 2021 at 12:32 pm #1285004Hi,
Could you please share example code using – https://pastebin.com/? I tried testing it on my local installation and closed open A tag etc but it still throws an error.
I would like to see if inserting your code using shortcode would help :)Regards,
YigitMarch 3, 2021 at 3:02 pm #1285041Hi Yigit,
Sure, please find in the details. it seems to work on first save, but then when the page is saved again the URL/window.open seems to be stripped.
Thanks,
DanMarch 3, 2021 at 3:20 pm #1285043Hi Dan,
Thanks!
It actually works even after editing the page on my local installation with updated code. I tested using shortcode and that worked as well.
Could you please try adding the code I shared in private content field and try displaying your date picker using [dp_sc] shortcode and check if that helps?
Best regards,
YigitMarch 4, 2021 at 2:03 pm #1285402Hey Yigit,
Awesome – thanks for the help, that is no longer clearing the onClick command.
Last question: I have 28 versions of this I need to use on different pages (4x languages / 6x room types) – the only variable on each one is the URL slug of where the click action re-directs to. Will I need to duplicate the code for each one individually, and will they all need unique function codes, or can they all have the same ‘function roomraccoonshortcode’ but with a different shorcode?
Much appreciated,
DanMarch 9, 2021 at 1:10 pm #1286692Hi Dan,
Sorry for the late reply!
That should be possible. You could use if conditions for languages and attributes for room types – https://codex.wordpress.org/Shortcode_API
I have been meaning to provide you a complete shortcode as well however forums have been pretty busy after the most recent updates therefore I unfortunately did not have time to look into it.
Could you please look into it and if you cannot figure it out, let us know so we can assist you further as soon as we can? :)Best regards,
YigitMarch 10, 2021 at 11:36 am #1287048Hi Yigit,
Thanks. I’ll have to take a look, I’ve not really needed to use short-codes before so this is a new area, most of the websites I’ve built with Enfold before have either had in-page integrations, or not required them. I didn’t realise the ALB would clash with the code directly.
I’ve pushed the website live with what we have already, if you are able to give me some pointers/example that would be handy.
Many thanks,
Dan -
AuthorPosts
- You must be logged in to reply to this topic.
