Hello,
This is a follow up to the closed thread https://toolset.com/forums/topic/can-i-eliminate-or-modify-div-around-view-output-affects-the-layout-i-want/ (and a few other threads I've found).
Unfortunately, this code is not working for me. Please look at the following and let me know if I have errors:
The view ID is 4771
/** Remove filter query dev from Posts by Sku view */
add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output_no', 5, 2 );
function prefix_clean_view_output_no( $out, $id ) {
if ( $id == '4771' ) {
$start = strpos( $out, '<!-- wpv-no-start -->' );
if (
$start !== false
&& strrpos( $out, '<!-- wpv-no-end -->', $start ) !== false
) {
$start = $start + strlen( '<!-- wpv-no-start -->' );
$out = substr( $out , $start );
$end = strrpos( $out, '<!-- wpv-no-end -->' );
$out = substr( $out, 0, $end );
}
}
return $out;
}
But I get this:
<div id="wpv-view-layout-4771-CATTR9a934dd582fcfa85ebc9502d2b1cfdaaTCPID917" class="js-wpv-view-layout js-wpv-layout-responsive js-wpv-view-layout-4771-CATTR9a934dd582fcfa85ebc9502d2b1cfdaaTCPID917" data-viewnumber="4771-CATTR9a934dd582fcfa85ebc9502d2b1cfdaaTCPID917" data-pagination="{"id":"4771","base_permalink":"/product/stainless-steel-precision-three-jaw-chuck-round-008-375-capacity-btdm/?wpv_view_count=4771-CATTR9a934dd582fcfa85ebc9502d2b1cfdaaTCPID917&wpv_paged=WPV_PAGE_NUM","query":"normal","type":"disabled","effect":"fade","duration":500,"speed":5,"pause_on_hover":"disabled","stop_rollover":"false","cache_pages":"enabled","preload_images":"enabled","preload_pages":"enabled","preload_reach":1,"spinner":"builtin","spinner_image":"<em><u>hidden link</u></em>","callback_next":"","manage_history":"enabled","has_controls_in_form":"disabled","infinite_tolerance":"0","max_pages":0,"page":1,"loop":{"type":"","name":"","data":[],"id":0}}" data-permalink="/product/stainless-steel-precision-three-jaw-chuck-round-008-375-capacity-btdm/?wpv_view_count=4771-CATTR9a934dd582fcfa85ebc9502d2b1cfdaaTCPID917">
<!-- Results of view 4771 -->
</div>
Thanks for following up on this.
Dear Peter,
Thanks for the feedback, the codes you mentioned above does not work, I suggest you try another easy solution:
https://toolset.com/forums/topic/view-is-conflict-with-faq-of-visual-composer/#post-409193
In your case, you only need to do the step 2) and step 3)
Thanks for the help. That worked for me (and is easier to use for other views).
I am curious:
Why would the other solution be recommended (and I've seen it in more than one thread). Does that work in other situations?
Can there be a possible enhancement to views to "remove pagination div" checkbox? Many of the views I use only output a short list where I only want the clean output. It feels like this would be a good thing, as universally including the code seems like overkill. Perhaps a suggestion to developers...
- Peter
Both are workarounds, since Views plugin is updated, the workaround you mentioned above is outdated:
https://toolset.com/forums/topic/remove-pagination-div-around-view-output/#post-541686
And our developers have already noticed this issue, and I added this thread into it, hope it will raise the attentions.
Excellent.
It may simply not be possible, but it would be helpful to remove outdated answers in the support forum (or somehow mark them by version number) - especially since I received advice from another forum moderator...
Thanks for your help.
- Peter