How to post Source Code inside a Wordpress blog post

I just started a coding related wordpress bog to basicly discuss topics and store code snippets in. I installed a code syntax highlighter plugin which is very nice but I am having a problem. I just tried posting my first code related blog post and wordpress seems to only post some of my code and then it makes some of it not show, like it filters some of it out even though I am wrapping it in tags like this..

<pre class="brush:php">

<?PHP
my code
?>

</pre>

Some of my code works and some gets filtered out somehow. I know this is possible as many wordpress coding sites show source code. Do I need to modify something to make it work in wordpress?


UPDATE

I have confirmed that it does save ALL my code into the database it just filters it out when it try to print to screen, so when I go in to edit the post and textbox populates with ALL the source code intact

Answers


Did you read this Codex article? For highlighting code you can use wordpress plugins.


take a look at http://en.support.wordpress.com/code/posting-source-code/ that's what the official wordpress hosting supports, it's really easy to use and should be tested enough.


My guess is that you have unfiltered < or & signs in your code that need to be encoded. Use "&lt;" for < and "&amp;" for &.


Need Your Help

Removing everything except numbers in a strong

javascript regex

Hi was wondering if someone can please help?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.