I know what you're thinking... let me tell this guy about the dozens of plugins that are available to display HTML, PHP, etc. in your posts... I have literally tried ALL of them. I don't want a fancy plugin with javascript and syntax highlighting and all that jazz. I just simply want to be able to display the code exactly as it's written. I never use the crappy WYSIWYG editor with Wordpress, I always type all the code myself. The best plugin I have come across is sem-code-fix. It's very short and lightweight. It works PERFECTLY... except... When displaying HTML entities i.e.: © ® etc. etc. etc. It will convert them to their HTML equivalent. The source code of this plugin is short enough, so Ill post it here: add_filter('the_content','sem_fix_code','1'); function sem_fix_code($content) { return preg_replace_callback('!<code([^>]*)>(?:\r\n|\n|\r|)(.*?)(?:\r\n|\n|\r|)</code>!ims', 'sem_fix_code_callback', $content); } function sem_fix_code_callback($matches) { $escapedContent = $matches[2]; $escapedContent = str_replace("<","<",$escapedContent); $result = $result."<div class='code_child'>"; $result = $result.$escapedContent."</div><br />"; return $result; } PHP: That's all there is to it! And it works like a charm. All I have to do is wrap my code in <code> </code> tags. The only thing that doesn't work is that it will not display HTML entities exactly as I type them. I have tried adding the <pre> </pre> tags before and after the <code> tags to no avail. I am REALLY pulling my hair out over this- something that seems so simple but ends up becoming so difficult! ********* The reason I posted the source code of the plugin Im using is because I would like to continue using the same plugin. I was hoping someone here would be able to find a way to tweak something in it in order to prevent HTML entities from being translated. HELP PLEASE! Any assistance would be GREATLY aprpeciated!
I just noticed that when I made the above post, the PHP code that is displayed to you above did exactly what Im trying to prevent. It converted an HTML entity to a < character.