Sign up ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

How can I write code in wordpress? Like I want to be able to show something like:

function foo()
    return "bar";

Is there a plugin? I installed one called Code Markup, but this doesn't add any code options when I am adding a new post (at least not that I am seeing)

share|improve this question
What do you want the code to do? It depends based on what you want to use it for. – Vervious Mar 3 '11 at 2:32
@Nano8Blazex I don't want the code to do anything, I simply want to show code snippets in my posts, just like I am showing code in my question. – JD Isaacks Mar 3 '11 at 3:58
check this answer here if it's any help… – Lipis Mar 3 '11 at 4:18
also, check out – Michael Pryor Mar 3 '11 at 4:24
There's a codex page on this: – Vervious Mar 3 '11 at 8:54

4 Answers 4

No need for a plugin. All Wordpress Setups come with this option available (unless you change the default setup).

Just enclose it as follows:

<code>function foo()
    return "bar";

You can find it below.

Where is the code ?

share|improve this answer

I use the SyntaxHighlighter plugin. It works well, is simple to use, and supports a good variety of languages.

See an article on my site for example output.

share|improve this answer

Suppose I have a code written using Ruby

in my blog post I would do

[sourcecode language="ruby"]
def hello
  puts "Hi! This is Rohit here"

wordpress has this as a default feature. I haven't used any plugin for this.

Best of Luck.

share|improve this answer
I will try this out thanks. – JD Isaacks Mar 9 '11 at 14:02

Even blogs support sourcecode tags now.

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.