Tips

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. Just so you know.
    Vivek Kundra reinstated as federal CIO
    Tags: ( general )
  2. This reinforces the importance of physical access. If some has physical access to a device, you are going to be very hard pressed to prevent them from doing evil.
    Criminals sneak card-sniffing software on Diebold ATMs - Network World
    Tags: ( physical )
  3. Dave gives us a couple more tips of pulling binaries out of pcap file or from live network traffic, but more importantly does something that impresses me more. Addresses a miss-communication in a previous post.
    NetworkMiner follow up << SANS Computer Forensics, Investigation, and Response
    Tags: ( forensics network captures )
  4. A nice post cooked up in the Security Kitchen that provides us with two things. 1) A way to restrict browsing by location/machine and 2) a reminder that sometimes things are much simpler and easier than they appear. 🙂
    The Security Kitchen >> location-based browsing restrictions.
    Tags: ( controls tips )
  5. This has the potential to be very important. We will have to wait and see what come out tomorrow.
    Uh Oh, rootkit code to exploit major Intel chip flaw to be posted 3/19/09 | NetworkWorld.com Community
    Tags: ( vulnerability intel )
  6. Chris's slide deck from his talk at SOURCEBoston is available for download. Interesting stuff in there, even if you don't get the benefit of his patter to go along with the deck. 🙂
    Rational Survivability >> The Frogs Who Desired a King: A Virtualization & Cloud Computing Fable [Slides]
    Tags: ( cloud virtualization )
  7. Julie takes us to task for the the way we talk about our user populations and rightfully so. As she says, the way we talk in private can leak into our public discourse, often when we don't intend it to, leading to those whoops moments we all wish we could take back.
    Lazy. Apathetic. Careless. Stupid. : The Security Catalyst
    Tags: ( general )

That's it for today. Have fun!

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

Kevin

{ 1 comment }

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

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

  1. Interesting repercussions of if the speeds on this get higher and the file hash issue can be resolved.
    Air Force engineers develop BitTorrent sniffer - Ars Technica
    Tags: ( sniffer bittorrent )
  2. Three papers we could all probably benefit from looking at. My reading pile is growing.
    Holy cow! The infrastructure has gone critical * The Register
    Tags: ( whitepapers )
  3. Might want to be careful what passwords you allow your iPhone to remember.
    TippingPoint | DVLabs | What Security Are You Talkin 'Bout Willis?
    Tags: ( passwords ipone )
  4. Ed Skoudis has produced some nifty cheat sheets for us. One for Windows command line tools, one for netcat, and one for attack tools like metasploit, meterpreter, etc.
    <--InGuardians --> Defensive Intelligence
    Tags: ( windows netcat tips metasploit cheatsheets )

That's it for today. Have fun!

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

Kevin

{ 0 comments }

How to become a hacker…

by kriggins on May 16, 2008

in Tips

You may have all seen this already, but I just came across it. It's been around for a while, but I thought it was interesting. How to Become a Hacker by Eric Steven Raymond.

{ 0 comments }