• Resolved nathanwells

    (@nathanwells)


    It would be great to allow the option to use the drop cap style on more than the first character, especially for non-English languages. I’ve edited simple-drop-cap/includes/register-shortcode.php like this to just make the plugin follow where I put the shortcode:

    // select first letter of shortcoded $content
    	$wpsdc_first_letter_of_shortcoded_content = mb_substr( $wpsdc_shortcoded_content, 0, 1 );
    
    	// select remaining letters of shortcoded content
    	$wpsdc_remaining_letters_of_shortcoded_content = mb_substr( $wpsdc_shortcoded_content, 1 );
    
    	// add <span class="wpsdc"> to the first letter for shortcoded content
    	$wpsdc_spanned_first_letter = '<span class="wpsdc-drop-cap">' . $wpsdc_first_letter_of_shortcoded_content;
    
    	// return the spanned first letter and remaining letters
    	return $wpsdc_spanned_first_letter . $wpsdc_remaining_letters_of_shortcoded_content . '</span>';

    This allows for complex text languages like Khmer to include the vowels in the drop cap that surround the first consonant so that it renders the word correctly.

    Thanks for a wonderful plugin!

    https://www.ads-software.com/plugins/simple-drop-cap/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Allow more than one character’ is closed to new replies.