Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've got a WordPress blog on When posting something I'm including some sample Java code in the <code tags, is there any way I can have this formatted better? Such as syntax highlighting and line numbers etc?

An example of what I have is here, even though I have the code tags it doesnt seem to make it any more readable than normal text

Am I limited in choices as I've gone for the free option?

share|improve this question
I assume you mean as "the wordpress site". –  hakre Sep 4 '10 at 12:10
@hakre: There you go again with the improper casing of the trademarked term WordPress. I know you think it's a statement but it makes you (and the site) look sloppy. –  MikeSchinkel Sep 4 '10 at 19:14
@MikeSchinkel: From what I see in the revision history, I never edited that answer. –  hakre Feb 3 '11 at 11:35

2 Answers 2

up vote 7 down vote accepted supports code syntax-highliting. You can read all about it here:

for your specific example use:

[sourcecode language="java"]
package com.jameselsey.domain;

import java.util.ArrayList;
import java.util.List;

* This is a global POJO that we attach data to which we
* want to use across the application
* @author James Elsey
public class GlobalState extends Application
private String testMe;

public String getTestMe() {
return testMe;
public void setTestMe(String testMe) {
this.testMe = testMe;
share|improve this answer
You can use "lang" instead of "language" if you're into the whole brevity thing. –  Mr_Chimp Jun 15 '11 at 13:45

Yes you can. It's [code] *your code here* [/code] and you can even hint the language: [code lang="php"]<?php echo 'test'; ?>[/code].

This is the method I prefer (quick to write). There seem to be other ways as the following resource explains: Support: Code » Posting Source Code (

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.