To highlight code in WordPress posts:

  • Install plugin “WP-Syntax”
  • Embed code snippets in tags:

<pre lang=”objc” line=”1″>

</pre>

Insert tags and code in “HTML” edit mode and not in “Visual”.
Example PHP code highlighting with lines:

1
2
3
4
5
6
7
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Alert title"
                                                  message:@"Alert body"
                                                 delegate:nil
                                        cancelButtonTitle:@"OK"
                                        otherButtonTitles:nil];
[message show];
[message release];