WordPress: Customizing WP-Syntax

October 23rd, 2009

I noticed a little bug in the WP-Syntax plugin for WordPress – the line numbers don’t match when using code with comments, well at least in Firefox 3.5. I realized it was caused by the italics where the line-height increased by approximately 1 pixel. It’s not that bad when you have a couple of comments in the code, but 60 lines of code with around 10 lines of comments completely broke my line numbers. I figured out WP-Syntax is configurable and here’s how I removed the italics from code comments:

1
2
3
4
5
6
add_action('wp_syntax_init_geshi', 'my_custom_geshi_styles');
function my_custom_geshi_styles(&$geshi)
{
    $geshi->set_comments_style(1, 'font-style:normal;', true);
}
// Note that comments are okay now ;)

Place this in your functions.php file and refresh your page. More info about the other $genshi methods could be found in the Genshi Documentation.

Related posts:

  1. Javascript in WordPress: 2 Functions 2 Save Your Day
  2. WordPress: The wp_update_post Dates in Drafts
  3. WordPress: Extending the Contact Form 7 Plugin
  4. Adding mod_rewrite Rules to .htaccess in WordPress
  5. WordPress: Recent Comments by Category

Tagged: , ,
Shortlink: http://kovshenin.com/1509

Permalink or share:
  • Twitter
  • Digg
  • Facebook
  • del.icio.us
  • FriendFeed
  • Technorati
  • Google Bookmarks
  • LinkedIn
  • Ping.fm
  • Identi.ca
  • StumbleUpon
  • Print
  • email

One Response to “WordPress: Customizing WP-Syntax”

Including pingbacks & trackbacks

  1. uberVU - social comments linked here on October 23, 2009 at 1:44 pm

Leave a Reply