<?php
/* Get only listed posts */
$test_array = array(‘335’, ‘328’, ‘970’);
$query = new WP_Query( array( ‘post_type’ => ‘testimonials’, ‘post__in’ => $test_array ) );
global $post;
/* Get Post url */
$page_url = get_permalink($post->ID);
/* Get Post congtent */
$content = $post->post_content;
/* Remove visual composer shortcode like [vc_row] link that */
$desc = strip_tags(do_shortcode($post->post_content));
/* Remove empty spaces */
$desc = trim(preg_replace(‘/\s+/’,’ ‘, $desc ));
/* Get content with limit */
$desc = mb_strimwidth($desc, 0, 200, ‘…’);
?>
how do i actually use this? I need to strip all VC shortcodes and leave the content behind in all pages and posts, how do i do this? Cheers
LikeLike
Thanks for asking.
Have you maintained page templates for individual pages or default template for all pages we have to use above code in php page template file.
I think this answer is fine otherwise let me know plz..
LikeLike
they are all based on the default page templates in the theme so i just add the PHP to the pages? Thanks for getting back to me
LikeLike
Yes if single page template means you can add PHP code for default page template.
LikeLike