Need help running shortcodes on description
-
Hi – I need assistance running shortcodes on the description in WP SEO. I’m using a custom field for the excerpt & inside that field are shortcodes that need to be run.
https://www.ads-software.com/support/topic/plugin-wordpress-seo-by-yoast-feature-request-apply-shortcodes-in-meta-description?replies=3
does NOT work for me – it zaps my post (which also starts with that custom field!).I need to do SOMETHING to run those shortcodes. The function I have to create a custom excerpt works, and i use this shortcode in wp-views to create the excerpts on the home page. But I do not know a lot about filters, so I am sort of lost.
Here’s the shortcode function
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 ); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Need help running shortcodes on description’ is closed to new replies.