kodie
12/10/2015 - 8:16 PM

Removes the parent div and the hidden input element from WP-Views plugin output so that it doesn't break sliders. Set $id to the id number o

Removes the parent div and the hidden input element from WP-Views plugin output so that it doesn't break sliders. Set $id to the id number of your wp-view. TLDR: If you update wp-views and it breaks your slider, throw this in the theme's functions.php file.

function clean_wp_views_output($out, $id) {
	if ($id == '49') {
		$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;
}
add_filter('wpv_filter_wpv_view_shortcode_output', 'clean_wp_views_output', 5, 2);