I'm not able to remove the wpv-view-layout pagination markup of post relationship views, using standard WP method of removing them through a filter function. Example of the markup I'd like to remove:
<div id="wpv-view-layout-240-TCPID14" class="js-wpv-view-layout js-wpv-layout-responsive js-wpv-view-layout-240-TCPID14" data-viewnumber="240-TCPID14" data-pagination="{"id":240,"base_permalink":"/dienst/corporate-video/?wpv_view_count=240-TCPID14&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":"//localhost:3000/app/plugins/wp-views/embedded/res/img/ajax-loader.gif","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="/dienst/corporate-video/?wpv_view_count=240-TCPID14">
Views other than post relationships I have been successful to remove the unwanted pagination markup using this code:
add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 );
function prefix_clean_view_output( $out, $id ) {
$view_ids = array('21','58','93','97','122','143','155','210','105','106','240','254');
if ( in_array($id, $view_ids) ) { //Please adjust BOTH your Views IDs
$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;
}
Please advice.
Well, it is not suggested to use that code.
This code should be used only, and solely, for very rare cases when you want to return a Raw View OutPut.
This is not something that Views is designed for, but we provided that code for exceptional cases, and every time the supporter must warn the user about its fallbacks, and things that cannot work when you remove that part of the View.
I need to clarify as well what you mean by the "post-relationship views".
Do you mean the new feature here?
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/using-post-reference-fields-to-display-information-from-a-related-post/
And related to "I'm not able to remove the wpv-view-layout pagination markup of post-relationship views, using standard WP method".
This is not a standard WP Method.
This is a custom code, crafted by Juan 2 years back in time because some users wanted to have a clean loop output.
It is irrelated to pagination, as that can be removed by simply not adding the ShortCodes for pagination.
Or, is the issue you report, that you cannot anymore alter the View's Loop Output in our beta copies using the filter above mentioned?
I cannot confirm this, because I successfully removed the extra HTML with the code, on a beta Views.
Eventually, I might misunderstand the issue.
If so, please attach a Duplicator, and the exact steps to replicate the issue on the site.
https://toolset.com/faq/provide-supporters-copy-site/
Raw and minimal views output is what I need. I'm aware it will break certain features.
With "post-relationship views", I mean the post TYPE relationships feature in the beta, not the post reference field. My bad, should have stated that more precisely.
Well, in the posted code I see markup for pagination, so that's why I lazily called it pagination markup. I already had disabled the Views pagination in the admin. Yet it still outputs html code I don't need/want, hence why I use the php filter script to remove all of that. But that html markup is called the VIew's loop output, if I understand you correctly?
Anyways, weird enough when I check my page source now, this markup is gone. Not sure how, perhaps it has been fixed with yesterday's beta update, or something funny was previously going on on my end. But all seems fine now.