Skip Navigation

[Resolved] Views causing all jquery to stop on Single page

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

Problem: I have placed some HTML markup generated by a View in my site, but it causes a JavaScript reference error and breaks other jQuery and JavaScript on the page.

Solution: Do not include Views CSS classes that begin with "js-wpv" in the markup of your site unless they are placed by Views automatically. This can cause problems because these classes are used as triggers for specific JavaScript functions required for Views. Triggering those functions without a View will likely lead to unexpected errors.

This support ticket is created 4 years, 4 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 8 replies, has 2 voices.

Last updated by myleneB 4 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1731439

I disabled all plugins one by one and Views is the culprit.
On a Single establishment template in Elementor Pro, I have a Toolset map showing the location of the establishment
This works.
hidden link
However, nothing else in the page works: drop-down nav menu does not work, search icon in nav doesn't work, share buttons at bottom don't work, etc (They all work in the other pages of website).
If I disable Views plugin, they work.
Seems to be a conflict between plugins/wp-views/embedded/res/js/wpv-pagination-embedded.js?ver=3.2.1 and the jquery loaded by WordPress.
BUT it works on other pages in the website! Problem is on Single page only (but works when I disable Views)

I need Views to be activated since I use it in other parts of the website
I use it here hidden link for maps, and it does not conflict with the nav???

- Why?
- How to fix?
- Can I disable Views just on this Single template?

#1732553

Hi, normally this happens when a theme or plugin loads jQuery without enqueueing it using WordPress standards and the proper script handle. I can see you're using a custom theme and a few other plugins. As a quick test, please switch to a default theme like Twenty Twenty, deactivate all plugins except Toolset and Elementor/Elementor Pro, and test again. Is the problem resolved - does the sidebar View display correctly? If so, then it's likely a problem in the way the theme and other plugins are enqueueing jQuery (or not enqueueing it). Reactivate your theme and test again. If the problem returns, then it's likely a conflict in how the theme is enqueueing or inserting the jQuery script. What can you tell me about how jQuery is enqueued in the theme? Is it hard-coded into the header somehow, or is it enqueued using wp_enqueue_script? What script handle is used?

If the problem does not immediately return when you activate the theme, reactivate other plugins one by one, testing each time until the problem returns. If there is one plugin that seems to be responsible for a conflict, let me know and I can run some additional tests on that plugin.

#1733177

Thank you for your response, but please read the first line of my message.
I did deactivate all plugins, culprit is Views.

I just did what you asked: changed theme and deactivated all but Elementor / Tooset.
Not working. Still can't get dropdown in nav to work, social media buttons don't work, etc.

In toolset > Settings I have:
Toolset should load Bootstrap 4 (it was Bootrap 3 before, I tried 4 but it makes no difference)

In the page source code I see:

<script type='text/javascript' src='hidden link;
<script type='text/javascript' src='hidden link;

Doesn't WordPress enqueue jquery by default?
My theme is _Underscore, a barebone theme, that does not enqueue jquery
I use this theme on 8 other WordPress website, never encountered a jquery problem with it.

And why only on this page and not the rest of website?
Any help appreciated, I can't get this to work.

#1733183

My issue is resolved now. It was my fault, but here is the answer if someone is having the same problem:
I had to paste HTML code in Posts because Views and Elementor could not do what I needed.

In that code was:
<div class=" js-wpv-view-layout js-wpv-layout-responsive wpv-pagination js-wpv-layout-has-pagination wpv-pagination-preload-images js-wpv-layout-preload-images wpv-pagination-preload-pages js-wpv-layout-preload-pages monp" style="visibility: visible;">

I thought those classes were just used for CSS.
Turns out, they are used for js calls

When I replaced with
<div class="monp" style="visibility: visible;">
Then the js on the page started to work again.

#1733621

OK now Views is causing another webpage to malfunction
hidden link
this page can only appear if Views plugin is deactivated
Plus
hidden link
try to go on page 3 or 4
It gives 404 page
That was the case last year, and I could never fix it.
How to make webpage work? How to make pagination work?

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/views-blocks-custom-post-type-archive-for-etablissements/

#1733623

If you go to Toolset > WordPress Archives, is there an archive assigned to the Etablissement post type? If so, can you edit that archive and disconnect it from the Etablissement post type? Does this produce the proper results?

#1734611

There is nothing in Toolset > WordPress Archives.
Should there be?
Also: on hidden link
Now the page is just NOT showing up (only header / footer are appearing, no content)
I have to deactivate Toolset completely just for the page to appear

#1735051

There is nothing in Toolset > WordPress Archives.
Should there be?

Well it depends on how you expect to design the loop for this page. I assume etablissement is a custom post type created in Types, and I assume the /etablissement URL is an archive of those posts created automatically by WordPress. Normally to design the loop of an archive with Toolset, you would create a Toolset WordPress Archive and assign it to the Etablissement post type. Depending on how your theme is set up, there may be a custom archive PHP template like archive-etablissement.php that manages the design of this page, and you don't want to style it with Toolset. So there are a few different things to consider here. I think this problem is different enough from the original jQuery issue to qualify for a separate ticket. I will split off a new ticket so we can discuss this issue in more detail, and follow up with you in the new ticket shortly.

#1739767

I found the answer here:
https://wpml.org/forums/topic/pagination-3/
This is a bug and we have escalated this issue to our development team. Meanwhile, as a workaround please go to WPML > Settings > Post type Translation and then set "Pages" to "Translatable - only show translated items".
This should fix the problem of pagination.

I did that and pagination started to work.

However, this was published JUNE 14, 2018 AT 7:40 AM
Still no fix...