shortcodes rendered manually don’t function
-
Hi,
I’m new to the plugin, and I’m not a novice dev, and I’ve struck exactly the same error message as previously reported here. My use case may be different.I’m trying to generate both a popup and trigger button on the fly, on a custom template page. The popup is not being inserted in the post-body field in the Editor, but instead I’m using PHP to generate the shortcode tags and then
do_shortcode()
to render it. Same for the trigger buttons.The popup is also not pre-defined in the popup list (and I couldn’t see anywhere in the docs that this was stated as a requirement).
Trigger shortcode:
[popup_trigger tag='button' id='new-enquiry']<li><span class="title">9ct</span> - <span class="price">$1,490</span></li>[/popup_trigger]
Popup shortcode:
[popup id="new-enquiry" theme_id="3098"][gravityform title='false' description='false' ajax='true' id='1'][/popup]
Rendering these gives me the buttons, as expected, and I can see the popup, with the gravity form inside it, hidden in the DOM.
With no other popups present on the page (apart from the one defined by the shortcode), clicking a trigger button does nothing – I assume this is because the plugin is unaware that there’s a popup on screen, and the relevant JS is not loaded? I couldn’t see a documenteed way to manually load it.
If a pre-defined popup is present in the DOM, with its ID targeted by the trigger buttons, it works. If it has the same ID as the shortcode generated one, then it shows (not the shortcode one).
But if the button targets the shortcode generated popup only, clicking the button gives the same JS error as previously reported.
In site.js on line 1182:
if (settings.mobile_disabled !== undefined && settings.mobile_disabled) {
settings is undefined which means $popup.popmake(‘getSettings’) is returning nothing.
I’m stumped. Unsure if I’m outside the bounds of how the shortcodes must be used in order to function.PS as an aside, I tried turning on debug, but I get a different console error as the page loads:
case “click_open”: pum_debug.click_trigger(t, o.settings), console.log(i.label_cookie, o.settings.cookie.name) }
returns the following JS error:
cannot read property ‘name’ of undefined
Seems to me that my popup is not being correctly initialised in some way, that one created in the post editor would be…?
- The topic ‘shortcodes rendered manually don’t function’ is closed to new replies.