• Resolved Illuminatus_PPM

    (@illuminatus_ppm)


    Hi Alexander! Thanks for an amazing theme.

    The dropcap shortcode works fine when viewing a single post, but does not seem to appear on snippets or previews, e.g. on the blog home page listing. Is there something we can do about this?

    Thanks!

    Illuminatus

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thanks! Shortcodes will not appear in excerpts.

    So, if the first character of the excerpt dissapears, go to edit the post, then top right side click “Screen Options” dropdown and enable Excerpt. Then scroll down below the large text field and add your excerpt in the excerpt box without the dropcap there.

    Thread Starter Illuminatus_PPM

    (@illuminatus_ppm)

    I fixed it by adding the following to the theme’s functions.php, under Custom Functions:

    function remove_dropcap_shortcode($text = '') {
    	$raw_excerpt = $text;
    	if ( '' == $text ) {
    		$text = get_the_content('');
    
    		$text = str_replace("[dropcap]","",$text);
    		$text = str_replace("[/dropcap]","",$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', 1);

    Feel free to include it in the next update 🙂

    Edd

    Thanks for sharing! Good stuff 🙂

    Thanks for sharing, I was looking for the same thing!

    Thanks Illuminatus_PPM, your fix really works for me

    Superb – thanks Illuminatus_PPM.
    Dr. Agnarson – thanks for the theme. We are all in your debt! I have hugged many people since I downloaded it.

    Hi. I am back with a related issue… On the mobile version, drop caps appear in plain text… I.e. They appear as “[dropcap]A[/dropcap]” … Any clues?

    Ah… I see this thread is marked ‘Resolved’ … I will open a new one!

    nice, thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Dropcap not appearing on blog home page’ is closed to new replies.