[Resolved] Update crashes Slider

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.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Beda 3 years, 10 months ago.

Assigned support staff: Beda.

Author
Posts
#353244

After I updated VIEWS to 1.11.1
All my Sliders on all my pages are fucked up because since the update VIEWS plugin adds
a

<div id="wpv-view-layout-56-CPID2" class="js-wpv-view-layout js-wpv-layout-responsive" data-viewnumber="56-CPID2" data-pagination="{"ajax":"false","effect":"fade","duration":500,"stop_rollover":"false","cache_pages":true,"preload_pages":true,"pre_reach":1,"spinner":"default","spinner_image":"<em><u>hidden link</u></em>","callback_next":"","max_pages":0,"page":1}">
<input type="hidden" id="js-wpv-pagination-page-permalink" value="/?wpv_view_count=56-CPID2&wpv_paged=1" />

To the HTML ouput.
I'm really heavyly pissed of because which each update I have to fear that some unexpected behavior is cause by VIEWS or Types. I'm so glad that I've switched all new site to ACF Pro which is rocksolid.

I've tried to remove [wpv-filter-meta-html] vom the Views settings with no result.
I've created a VIEW from the srcatch with the same result.

No idea what to do...

#353343

Push. For real premium support.

#353425

Beda
Supporter

Languages: English (English ) Spanish (EspaƱol ) German (Deutsch )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Thank you for contacting us here in the Support Forum

I deeply apologize this inconveniences.

Please let me explain why this happened.

1. You seem to use the Views Plugin in a way that was and is not intended to be used this way.
Views is a Data Render Engine, not a data provider.

If you build a slider with Views, this will work with the inbuilt features of Views to do so.

The additional HTML would not have effect.

If you on the other hand used Views to only PROVIDE the data but actually created the slider with another Plugin or Code (populated data with Views) this new HTML will destroy your current setup.

2. Why this HTML has been added, is mainly due to new features such as infinite scrolling and also features to come, such as "Front End Sort By" or "Front End Order by".

It can not be removed from the Default screens.

To remove it, you need a Custom Code Filter.

add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 );

function prefix_clean_view_output( $out, $id ) {
    if ( $id == '375' ) { //Change the Views 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;
}

Step by step:
- It hooks early in the View output. Priority 5 is mandatory as we already do some other cleaning at priority 10.
- It only affects a View with an ID of 375, adjust acordingly if needed.
- It only affects Views with actual results: if the View matches no result, the same "No items found" or whatever you have between the wpv-no-items-found shortcode applies.
- It returns only what is between the HTML comments <!-- wpv-loop-start --> and <!-- wpv-loop-end --> , excluding them.
- Only content between those HTML comments is returned, as is.

Notice that, with this applied to a given View ID:
- Pagination, specially AJAX pagination, will not work.
- Parametric search, specially AJAXed parametric search, will not work.
- Other future features will not work either.

So this is to be used if and only if you are going to use the View output as source for anything else.

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.