wordpress

If you do any sort of technical writing on WordPress, you have likely run into the wonderful little quirk of it turning your lovingly formatted double dashes '--' into singe em dashes. Rather annoying.

To add insult to injury, the silly thing shows them as double dashes in the editor, but then renders them as em dashes when viewing the post, making it next to impossible to know what is going on.

I thought I had it fixed at one time, but apparently the behavior snuck back in. I finally got tired of writing "those are two dashes not one" all over the place and went in search of a better answer.

Lo and behold I found one. Peter Cooper had the same problem and figured out how to take care of it. You can see his post here. His is for WordPress 2.5, but it also works for 2.8.x. I have combined his directions along with some info from the comments on his post here just in case I need it again and can't find it 🙂

Update: After I posted this, one of my friends on twitter, Chris John Riley, offered up another option. Add an HTML comment with just a space between the dashes. You will have to do this in the HTML view instead of Visual view of the editor. It will look like this:

-<!-- -->-

As I said to him, definitely less intrusive, although, with the method below, I just double dash away and don't worry about it 🙂

Thanks Chris!

WordPress has a built-in function called wp_texturize(). The purpose of this function is to make your beautiful prose lovely to look at too. 🙂 Unfortunately, for those of use who do technical writing, it also completely mucks up some of our stuff.

To stop this from happening you need to edit the functions.php file in your current theme. This file is in your wp-content/themes/<your theme> directory.

All you have to do is add the following three lines to the end of the functions.php file.

<?php remove_filter('the_content', 'wptexturize'); ?>
<?php remove_filter('comment_text', 'wptexturize'); ?>
<?php remove_filter('the_rss_content', 'wptexturize'); ?>

These lines tell WordPress to quit mucking with punctuation in the main content, comments and rss feed. If you want to allow it to do so in any of the three, just omit the appropriate line.

Here is my functions.php file for reference:

<?php
  // Current version of K2
  define('K2_CURRENT', 'hidden cause you don't need to know');

  // Is this MU or no?
  define('K2_MU', (isset($wpmu_version) or (strpos($wp_version, 'wordpress-mu') !== false)));

  // Are we using K2 Styles?
  define('K2_CHILD_THEME', get_stylesheet() != get_template());

  // WordPress compatibility
  @define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
  @define( 'WP_CONTENT_URL', get_option('siteurl') . '/wp-content' )

  /* Blast you red baron! Initialise the k2 system */
  require_once(TEMPLATEPATH . '/app/classes/k2.php');
  K2::init();
?>
<?php remove_filter('the_content', 'wptexturize'); ?>
<?php remove_filter('comment_text', 'wptexturize'); ?>
<?php remove_filter('the_rss_content', 'wptexturize'); ?>

One final note, this also affects all other punctuation changes, so you won't get smart quotes, etc.

-Kevin

{ 0 comments }

Good afternoon everybody! I hope your day is going well.

Here are today's Interesting Information Security Bits from around the web.

  1. Be careful. It doesn't appear that it is very hard to turn you Windows 7 install into an wireless access point.
    Errata Security: Windows 7 includes soft-ap
    Tags: ( windows-7 wifi )
  2. Some good tips for making sure your WordPress install is as secure as possible.
    10 Ways To Secure Your WordPress Install
    Tags: ( wordpress )
  3. Offensive Security is setting up the next iteration of milw0rm.
    Leaders in Online Information Security Training >> Offensive Security Exploit Archive
    Tags: ( milw0rm offensive-security )

That's it for today. Have fun!

Subscribe to my RSS Feed if you enjoy these daily Interesting Bits posts.

Kevin

{ 0 comments }

Good afternoon everybody! I hope your day is going well.

Here are today's Interesting Information Security Bits from around the web.

  1. Check out your ability to get off the hook in a phishing attack. 🙂
    Network Security Blog >> How's your phishing savvy?
    Tags: ( phishing )
  2. If by chance you didn't get your WordPress installation patched in time and ended up comprised, here are a couple references for cleaning up that situation. Granted, a scorched earth policy is probably best, but it may just not work for you.
    How to clean up a hacked WordPress installation - The HP Security Laboratory Blog -
    Tags: ( wordpress tips )
  3. Good stuff from James on establishing/writing/rewriting your information security policies.
    Policies don't have to be painful : The Security Catalyst
    Tags: ( policy )
  4. This is a must see. (Hat tip to @aneel)
    Nerd Venn Diagram [PIC]
    Tags: ( humor )

That's it for today. Have fun!

Subscribe to my RSS Feed if you enjoy these daily Interesting Bits posts.

Kevin

{ 0 comments }

Good afternoon everybody! I hope your day is going well.

Here are today's Interesting Information Security Bits from around the web.

  1. A very nice analysis of the current WordPress admin password reset issue. BYW - Go fix your installs.
    Digital Soapbox - Preaching Security to the Digital Masses: WordPress Bugs... A Disturbing Vulnerability
    Tags: ( wordpress )
  2. PCI v1.2.1 is official now. See inside for the details.
    Branden Williams' Security Convergence Blog: PCI DSS Goes v1.2.1
    Tags: ( pci )
  3. Looking for some pcap data sets to play with. Richard points to some recent ones published some by West Point.
    TaoSecurity: 2009 CDX Data Sets Posted
    Tags: ( pcap )
  4. You really owe it to yourself to check out this post and attendant white paper. CRSF is some scary stuff.
    Neohaxor.org >> Blog Archive >> Dynamic Cross-Site Request Forgery (CSRF)
    Tags: ( crsf )

That's it for today. Have fun!

Subscribe to my RSS Feed if you enjoy these daily Interesting Bits posts.

Kevin

{ 0 comments }