Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #615438

    Hi,

    It seems that every text included in the shortcode “av_dropcap1” is missing in the RSS Feed.

    I’m using it at the beginning of every post on my blog so in the RSS feed, the first letter is missing (see http://blog.smartwithou.com/feed)

    I found a solution that doesn’t seem to work everytime. I added the following code to my functions.php file :

    function remove_dropcap_shortcode($text = '') {
    	$raw_excerpt = $text;
    	if ( '' == $text ) {
    		$text = get_the_content('');
    
    		$text = str_replace("[av_dropcap1]","",$text);
    		$text = str_replace("[/av_dropcap1]","",$text);
    
    		$text = strip_shortcodes( $text );
    
    		$text = apply_filters('the_content', $text);
    		$text = str_replace(']]>', ']]>', $text);
    		$excerpt_length = apply_filters('excerpt_length', 55);
    		$excerpt_more = apply_filters('excerpt_more', ' ' . '[…]');
    		$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    	}
    	return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
    }
    add_filter( 'get_the_excerpt', 'remove_dropcap_shortcode');
    add_filter('the_excerpt_rss', 'remove_dropcap_shortcode');
    add_filter('the_content_feed', 'remove_dropcap_shortcode');

    But as you can see, the last published post still as the issue. I also think that this is an issue that, if related to the enfold theme, should be correct directly in the theme instead of having to “patch it” into the code.

    Could you help me sort this out ? Thanks in advance.

    #617152

    Hey smartwithyou!

    Thank you you for using Enfold.

    Please replace the code with this:

    function remove_dropcap_shortcode($text) {
    	$text = strip_shortcodes( $text );
    	return $text;
    }
    add_filter('the_excerpt_rss', 'remove_dropcap_shortcode');

    Cheers!
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.