Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am really frustrated with availible Syntax Highlighter's on the market it seems that no matter which one I use, after pressing "Save Draft" or "Publish" and after I change from Visual to Html or reverse I am loosing the xml snippet code. Also, other code (C#, PHP) just loosing their style, especially break lines making code unreadable. My configuration is

  • WordPress 3.2.1.
  • Easy Google Syntax Highlighter,
  • SyntaxHighlighter TinyMCE Button,
  • SyntaxHighlighter

I really like WordPress however writing and espessially editing posts in admin panel, which is very handfull, make it impossible because it just looses and stripping code formating. So, the question is which plugins do you use or do you write posts through admin panel?

share|improve this question
    
I agree, this is really a pain in the a**. I can't find a single plugin that allows me to publish code easily. How all those blogs are doing that ? Writing posts in html only ? –  Julien N Dec 16 '11 at 17:26

2 Answers 2

Your best bet is to use custom post meta to store the code, and output it however you want. In other words, skirt the editor entirely. Here's a really clever WP theme by Dan Cederholm that does this like a champ.

share|improve this answer

A nice solution to this problem is by using the "gist" feature of github. Simply create a gist with one or more files on github and embed them in your wordpress post like this:

[gist file=FILENAME.xml]GIST-ID[/gist]

You can leave the filename if you have only one file or want to display all files.

share|improve this answer

Your Answer

 
discard

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.