Creating a custom Elementor Popup trigger with PHP and JavaScript
Вставка
- Опубліковано 21 лип 2024
- In this tutorial, I'll guide you through the process of creating a powerful customization - your very own popup triggers based on the active language in Polylang. 💻🌐
🔍 Dive deep into the code as we explore how to show or hide popups dynamically, tailored to the language your visitors are experiencing. No more generic popups-make your content relevant and targeted.
🔧 We'll dissect the process step by step, ensuring you understand the intricacies of linking Elementor with Polylang to achieve a seamless language-based trigger system. 💬👁️🗨️
👍 If you're ready to take control of your Elementor popups, subscribe now and stay tuned for more advanced customization tips! 🔗🚀
#Elementor #Polylang #WebDevelopment #PopupTriggers #Multilingual
Github repo:
github.com/ArneDeBelser/eleme...
Chapters:
0:00 Introduction & example
1:10 Explain Elementor internal workings
2:24 Prepare plugin and folder structure
3:00 Create the base classes
4:12 Convert plugin to Singleton
4:48 Introduce proper namespacing and class imports
5:14 Inject controls into Elementor popup widget triggers
6:28 Recap explanation of how we inject the controls
6:54 Add the control header
8:02 Instantiate some option variables
8:26 Write the options logic
9:55 Recap explanation of how options logic works
10:58 Create the last two controls (select2 and switcher)
11:58 Create the AJAX endpoints
13:02 Write the JavaScript file
16:26 Fixing some typos
16:42 Outro and thanks!
Thank you so much for your effort in making this wonderful video.
Because you seem so experiences, could you help me with an issue?
When you land on my shop page the variation swatches script loads at the same time.
But when I filter products using Ajax, the swatches script doesn’t load for the refreshed products.
Swatches scripts load before you send a request for the latest filtered products. It ends up showing all variations as available.
The default behavior is page will load and the script will be refreshed. So, I need the triggers that are fired after they process their products without loading the page.
If I find the right trigger I will be able to figure this out.
Hi there,
I will try to make a guess, but I have a hard time understanding your question. Could you try rephrasing and maybe use gyazo to make some screenshots URLs?
Great stuff, thank you for sharing and for detailed explanation of how you achieved this. Super nice, useful and eductaional.
BTW, it might be a case that the latest release of elemenntor 3.19 may be able to do this with its new per widget conditional & dynamic data capabilities, e.g. if user logged in, if language? liked and subscribed. THANK YOU.
Indeed, there's probably a way to query these parameters and use them for coditionals.
This specific use case was something I had to work out for a client project.
Thanks for the sub!
Thats really cool! Is it possible to trigger the popup based on browser language? I use WPML and would like to trigger a popup if the user comes in on the spanish (default) site but the browser language is english.
That would be possible, in that case you don't need to write all the language based code (which I wrote for polylang). A simple AJAX call that checks the users browser language and acts accordignly should be sufficient.
stackoverflow.com/questions/8199760/how-to-get-the-browser-language-using-javascript
Is there how to turn my elementor pop-up into a javascript?
I don't understand your question, could you elaborate?