Using Pullquotes Part Two

In my previous post I showed you how to easily add pullquotes to your WordPress blog by simply adding a new class to the existing blockquote. Now I'll show you a way to do it without manually adding class="mag" to every blockquote tag. We do it by adding a new button to the Text Editor Toolbar.

Remember back in November when I showed you how to add a couple of buttons to the toolbar to automatically align images to either the left or right? (see Customizing WordPress Text Editor Toolbar) We are going to do the same thing here. The file we need is located at wp-includes/js/quicktags.js. Open up quicktags.js and look for the following at around line 60 ...

edButtons[edButtons.length] =
new edButton('ed_block'
,'b-quote'
,'\n\n<blockquote>'
,'</blockquote>\n\n'
,'q'
);

Somewhere below that block of code add this ...

edButtons[edButtons.length] =
new edButton('ed_pull'
,'p-quote'
,'\n\n<blockquote class="mag">'
,'</blockquote>\n\n'
,''
);

This will add a new button to the toolbar called p-quote. To add a pullquote to your blog just click that button. Below is a screen capture of what my new toolbar looks like. (click image to enlarge)

2008-04-21_0606

One thing to remember, since you are modifying core files the modification will vanish the next time you upgrade your WordPress install.

About the author
Len has been blogging for over 10 years and is a rabid WordPress fan. In addition to blogging here you can find him writing the occasional article and toiling away in the forums at WeblogToolsCollection.com. He also hangs out at the WordPress support forums lending a hand where he can. You can also find him at his other blog LenKutchma.com

Leave a Reply

CommentLuv Enabled