Remove Curly Quotes

In a previous post entitled More on Quicktags I showed you how I added a few new quicktags to my post toolbar. Since I write quite a few how-tos on this site I needed a fast and easy way to include code in my posts. For instance, rather than manually type in &lt; whenever I wanted to display a < or &gt; to display a > I added a couple of buttons (quicktags) to the toolbar to do the job for me.

The other problem I encountered was the way in which WordPress displays quotes. It makes use of what is known as curly quotes. Curly quotes are generally suitable for most blogs but not if you want to include code in your posts, especially code that someone will copy and paste from your blog in to their own. The solution is simple. Add the following to your theme's function.php file (create one if it doesn't exist) ...

remove_filter('the_content', 'wptexturize');

If you want to remove curly quotes from your comments section add this to functions.php ...

remove_filter('comment_text', 'wptexturize');

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

5 Responses to “Remove Curly Quotes”

  1. I can understand why you would want to remove curly quotes for your purposes. But I want those quotes. Unfortunately, neither Typepad nor Blogger does that automatic conversion that WordPress does (I add curly quotes manually).

    Do you know of any CSS trick to change quotes and apostrophes to the curly format automatically? In other words, I am looking for the reverse of your remedy.

    Werner Patels’s last blog post..Jack thirsting for power

  2. I think I looked at that link the other day, and unless I am mistaken, it is actually a code for styling a blockquote with curly quotes as graphic markers. I am looking to convert all standard quotes (such as in: Then Harper said, ".......") inside sentences of the regular post body (not as a special style for blockquotes).

    Werner Patels’s last blog post..Jack thirsting for power

  3. Yep, that's the site I looked at the other day. In Firefox their example works like a charm. I've just been to the site again now, this time with IE, and guess what, their nice curly quotes wrapped around the blockquote doesn't show in IE.

    So, yeah, this is not what I am looking for. :-(

    Werner Patels’s last blog post..Jack thirsting for power

  4. Len Kutchma says:

    Hi Werner! That's a very good question. Here is a link that may be of interest to you. Using that information, I would create a second type of blockquote (called blockquote2 or something) in the CSS and apply the styles to it. Then when you want to use it simply invoke the regular blockquote remembering to stick that 2 in there. (blockquote2 - remember?)

  5. Len Kutchma says:

    Hmmm, I see what you mean. I'm not sure if there is a way to automate what you want. At least not that I'm aware of.

    I'll have to look into this a little deeper.

Leave a Reply

CommentLuv Enabled