Don’t mind me II
Just testing a plugin I’ve knocked up to replicate something I found something in the archives over at Mandarin Design (thanks to Lynne’s comment). It’s rather a nice effect, isn’t it? I wonder whether there’s a way to automate it so that the first letter of every post gets a dropped-cap effect. That may be going over the top, though.
The plugin in full reads:
<?php
/*
Plugin Name: Em3 Dropcaps
Plugin URI: http://a-fresh-start.a-blog.org/
Description: Use this to change
Author: Em3
Version: 0.1 pre-beta ![]()
Author URI: http://a-fresh-start.a-blog.org/
*/
/* Based on a neat effect I found in the archives at
Mandarin Design and inspired by Lynne’s comment about having to code it by hand.*/
function drop_caps ($text, $case_sensitive=false) {
$preg_flags = ($case_sensitive) ? ‘e’ : ‘ei’;
$output = preg_replace(”‘<d>([^\/]*)</d>’$preg_flags”, “dropcap_link(’\\1′)”, $text);
return $output;
}
function dropcap_link($cap) {
$output = “<span style=\”float:left; color:#000000; font-size:90px; line-height:70px; padding-top:2px; font-family: times, ‘times new roman’;\”>$cap</span>”;
return $output;
}
add_filter(’the_content’, ‘drop_caps’);
?>
Just copy and paste this into Notepad (or an equivalent) and save it as dropcaps.php in your wp-content/plugins directory. Activate the plugin and use <d>W</d>ord at the start of posts. Easy. If you want to change the text colour, just edit the color:#000000; to something like color:#000066; and you can even add a background colour by including background-color: #ccccff; in the style as I have done, should you wish.
If that’s too much hassle, install WP-AddQuickTag and add it to your QuickTag buttons.
Modified
Author
Lynne says:
Added on April 30th, 2006 at 5:17 pmHmm, maybe I’ll try it out, good job there EM
Em3: Thanks. It’s not quite the full automation I was looking for but it’s pretty close.
Daisy says:
Added on April 30th, 2006 at 10:51 pmI keep meaning to install QuickTag so that I can automatically generate blockquote code with paragraph tag inide, dammit.
*adds to long, long list of fings wot I must do*