Skip Navigation

[Resolved] Views pagination and Shortcodes Ultimate plugin

This thread is resolved. Here is a description of the problem and solution.

Problem:
I have a view that displays posts with ajax pagination enabled.
I have also a plugin "shortcodes ultimate" that triggers a popup that contains information related to the post being clicked on.

The problem is that the popup is not being triggered after navigating to a page in the view.

Solution:
The issue here is that the Views plugin loads the elements dynamically using ajax and because the click events are not being bound to the newly loaded elements, the event is not being triggered and the popup doesn't show.

So, please make sure that if a plugin is triggering an event, he should use the Jquery "on" function to bind the event to the newly loaded elements in the document like the following example:

$(document).on('click','.su-lightbox', function (e) {});
This support ticket is created 7 years, 11 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 – 10:00 - - - - -
- - - - - - -

Supporter timezone: Africa/Cairo (GMT+02:00)

This topic contains 7 replies, has 3 voices.

Last updated by geophray 7 years, 11 months ago.

Assisted by: Mohammed.

Author
Posts
#393492

I am using the Shortcodes Ultimate plugin to insert a shortcode in a view with pagination that loads more details about the post in a lightbox. It works well until the pagination is used, and then does not function again on that particular paginated section. (I have about 5 paginated views on my home page as section sliders.)

I'm unsure of why it would work perfectly until the pagination is used. Have you had any other reports of this? Or are you able to replicate it?

Here is the code I'm using in my content template.

<div class="bgu-course-lightbox-wrapper">
  [su_lightbox type="inline" src="#course-overview-[wpv-post-id]" class="overview-lightbox-link"]
    <div class="bgu-course-card">
      <div class="bgu-course-card-thumbnail">[wpv-post-featured-image class="circular"]</div>
      <div class="bgu-course-card-title">[wpv-post-title]</div>
      <div class="bgu-course-card-teachers">by [php snippet=5]</div>
    </div>
  [/su_lightbox]
  [su_lightbox_content id="course-overview-[wpv-post-id]" margin="45" padding="45" text_align="left" class="overview-lightbox-content"]
  	[wpv-post-link]
  	[wpv-post-featured-image size='bgu-square-med' class='classy']
  	[wpv-post-body view_template="classroom-access-button-toggle"]
  	[wpv-post-body view_template="enroll-login-button-template-unenrolled"]
  	[wpv-post-body view_template="enter-classroom-button-template"]
  
  [/su_lightbox_content]
</div>
#393731

Hello Geophray,

Thank you for contacting Toolset support forum.

To be honest, I didn't see other clients reporting issues regarding "Shortcodes Ultimate plugin".

It seems that we have a compatibility issue. If we are talking about the lightbox that can't be triggered, then I doubt that it's a Javascript error prevents the lightbox to trigger.

So, please enable WordPress debug mode: https://codex.wordpress.org/Debugging_in_WordPress
And open the browser console: hidden link then open the page where the problem could be replicated and reload the page again then check the console tab to check if there are any Javascript errors and share it with me in the next answer.

Thanks.

#393810

Hi Mohammed. Sorry... no errors. I'm going to create a test install and see if I can replicate it elsewhere. I'll keep you posted.

#394286

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Geophray,

Mohammed is not available today, so i'll be filling in.

Great once you have setup the test instance please let me know.
Should you wish to provide us with admin access i've also enabled the private fields.

Thanks,
Shane

#396431

Hi Geophray,

I'm trying to replicate the issue.
Once I replicate it , I will start working on it.

It seems to be a compatibility issue to me but let me check and get back to you.

Thanks.

#396515

Thanks for your time and attention to the matter. I'll await your reply.

#396611

Hi Geophray,

Thank you for your patience.

This is indeed the shortcodes ultimate issue because they didn't take into account the ajax loading for the element.

View loads the elements dynamically using ajax and because the click events are not being bound to the newly added elements, the event is not being triggered and the popup doesn't show.

I've debugged the issue and found the cause behind this.
in file \wp-content\plugins\shortcodes-ultimate\assets\js\other-shortcodes.js , replace line 60 which is :

		$(this).on('click', function (e) {

by the following line

$(document).on('click','.su-lightbox', function (e) {

And see if the issue is resolved.

If this worked for you, you can mention the workaround to the plugin author.

Thanks.

#396614

Thanks Mohammed!

That did the trick. I'll suggest your edit to the plugin author.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.