Tell us what you are trying to do?
I'm trying to get the distinct list from wpv-view result.
ex)
the wpv-view result : a,a,a,a ,b,c,b,a => my expecting output : a,b,c
I made my own shortcode [ mydistinct mydata="a,a,a,a,b,c,b,a"].
I'd like to use wpv-view result as the parameter mydata.
But the wpv-view output looks to be formatted.
I found the resolved support : https://toolset.com/forums/topic/views-result-array-as-shortcode-parameter/
======================================================
add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 );
function prefix_clean_view_output( $out, $id ) {
if ( $id == '375' ) {
$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;
}
========================================
I did
1) add the function to function.php in my theme .
2) change $id == '375' to my view id.
but the output is not working. still formatted. ( attached file )
My question is
Is the filter hook "wpv_filter_wpv_view_shortcode_output" working?
or
anything I have to do ?
Thanks , in advance for your help
Insoo