Skip Navigation

[Resolved] Disabling Views wrapper divs Views 2.4.0 – solution provided breaks pagination

This support ticket is created 6 years, 10 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 3 voices.

Last updated by Mohammed 6 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#533269

I implemented this solution for disabling Views wrapper divs.

https://toolset.com/forums/topic/disabling-new-view-wrapper-div-in-views-2-4-0/

It does work as expected. HOWEVER I have now found that it is preventing pagination from displaying on paginated Views, which is causing some serious usability issues with the affected sites.

Can you expand or modify your solution so paginated Views work?

#533326

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - that is expected when you apply the said code.

Since Views 1.11 we have had to wrap Views loop outputs in default HTML and CSS/JS in order to support things like infinite scrolling, and future to come features like "Front End Sorting and Ordering" etc..etc..

Since Views was and is designed to create lists and displays of content, it is wrapping this content in HTML, to provide best support for all features.

Please acknowledge that when you add that filter to display view without wrapper divs will also mean, features like:
- Pagination, specially AJAX pagination, will NOT work.
- Parametric search, specially AJAXed parametric search, will NOT work.
- Other future features will NOT work either (endless scroll, future feature "sort by" in the front end, etc)

That means this is expected results.

#533355

My issue is resolved (by us, not by you), but I am very angry and I want you to understand why, and provide a proper response.

We have been using Toolset for a very long time - probably since 2011. We have built our entire business around the many capabilities it gives us. Many of our projects predate the 'Views wrapper div' functionality.

With over 150 live sites using Toolset, we have known for some time that this functionality broke some of our sites. We have reported it many times. The only sure solution was to avoid upgrading Views on the affected sites. But this is not a good solution, as upgrading WordPress to recent versions also stops the _older_ versions of Views working properly. And not upgrading WordPress is insecure and bad practice.

So your reply to this ticket, instead of offering a solution, offers a giant shrug, and I feel like you don't actually care that this feature - WHICH WE DON'T EVEN USE - is causing us problems and stopping us from making our clients happy.

It has to make me question whether WP-Types is really committed to providing good long-term support to its Toolset for Life customers, and not making our lives hell by rolling out new features without proper regression testing.

Now, by pulling one of my developer colleagues off another project, we were able to modify your code to only target specific Views, and I am pleased to provide this code here for other users.

/**
 * Naked Views output with no wrapper divs - SPECIFY WHICH VIEWS TO TARGET
 */
add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_naked_view_output', 5, 2 );
function prefix_naked_view_output( $out, $view_id ) {
    $views_to_target = array(599,3948,3026;// replace with your own comma separated list of View IDs
    if ( in_array($view_id, $views_to_target)) { // add test for View ID
        $start = strpos( $out, '<!-- wpv-loop-start -->' );
        if  (   $start !== false
                && 
                strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false ) {
 
            $start = $start + strlen( '<!-- wpv-loop-start -->' );
            $out = substr( $out , $start );
            $end = strrpos( $out, '<!-- wpv-loop-end -->' );
            $out = substr( $out, 0, $end );
        }
    }
 
    return $out;
}

Which makes me wonder, why couldn't you have done that?

Please, improve your attitude to maintaining long-term backwards compatibility, or I will seriously consider looking at alternative development approaches for new projects.

I would appreciate a response from the most senior person who cares to provide it.

#533380

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I'm sorry for the inconvenience but there is nothing personal here and thanks for using Toolset plugins for a long time and we are committed to providing you support as per your request.

Basically - without seeing your code and basically since it's known issue since long and as you are using Toolset since many years and with the recent ticket you shared I was in the impression that you must have corrected the if condition with view ID to bind view IDs to check for.

As you can see with following tickets - that I've shared same message and solution with the number of users with clear instructions to change/replace/target the view ID.
=> https://toolset.com/forums/topic/how-to-delete-a-line-in-the-loop-in-the-views/#post-437988
=> https://toolset.com/forums/topic/views-raw-output/#post-448728

Again - I'm sorry for the inconvenience and we are here and happy to resolve your queries, if any.

#533383

Meh. I am going to be grumpy until you give us a proper way to disable this bloody functionality without having to resort to scrabbling around in the forum looking for fixes, some of which don't work any more.

#550314

Hi Simon,

I'm Mohammed, the Toolset support team leader. I'm sorry to see you angry of our support service.

If your issue still happens, please post here a message and we immediately will do our best to fix it.

Or please mention here your complaints and we will react ASAP.

Thanks,
Mohammed.

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