Well, if anyone’s interested, I sneaked into my copy of bbPress and stole their code for using the backtick, then dumped it into a quick plugin. I’ve tested it to work with my WordPress 2.0.2.
Here’s the working code:
backtick-code.phps
Just activate this and you can write code as you would here on this forum (well they’re basically the same code). It doesn’t touch your database at all, just filters post excerpts, contents, comments and it seems that it does RSS feeds as well.
I’ve only made two modifications:
1) Rather not so elegant (I think) solution to replace leading spaces with
(for indentation). Also I just converted tabs into four
—sometimes I copy and paste code that indent using tabs, so I wanted those to work as well.
2) Within backtick code blocks, two backticks in a row will be converted back to one backtick when it is displayed. (Downside is you need to type four backtickes in a row, if you want to display a literal backtick while not inside a backtick code block.)
I like using backticks just because I’m lazy and don’t want to type a million CODE tags…although I do feel that the CAE plugin using the code tags is a “better” solution. After all, once you get settled into using backticks, these backticks will get stored into your database…
BTW: reminders on mistakes I made or on how to improve this would be greatly appreciated. I’m just a PHP beginner.
PS: I do not know if this works with the WYSIWIG editor. I’ve grown to hate that thing. ??