Here are my custom shortcodes – written by you guys.
add_shortcode('review-excerpt', 'custom_excerpt_func'); function custom_excerpt_func() { $post_excerpt = get_post_meta(get_the_ID(), 'wpcf-review-intro', true); $post_excerpt = preg_replace('/<img[^>]+>/i', '', $post_excerpt); $post_excerpt = do_shortcode($post_excerpt); $post_excerpt = apply_filters('the_excerpt', $post_excerpt ); $excerpt_length = apply_filters('excerpt_length', 200); $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); return wp_trim_words( $post_excerpt, $excerpt_length, $excerpt_more ); } //added add_shortcode('coupon-excerpt', 'coupon_excerpt_func'); function coupon_excerpt_func() { $post_excerpt = get_post_meta(get_the_ID(), 'wpcf-coupon-description', true); $post_excerpt = preg_replace('/<img[^>]+>/i', '', $post_excerpt); $post_excerpt = do_shortcode($post_excerpt); $post_excerpt = apply_filters('the_excerpt', $post_excerpt ); $excerpt_length = apply_filters('excerpt_length', 200); $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]'); return wp_trim_words( $post_excerpt, $excerpt_length, $excerpt_more );
here's how its implemented on my home loop
[wpv-if evaluate="'[wpv-post-type]' = 'subscription-box-review'"][review-excerpt][/wpv-if] [wpv-if evaluate="'[wpv-post-type]' = 'subscription-box-coupon'"] [coupon-excerpt][/wpv-if]
the first one… doesn't work any more. no idea why.