I’m having real problems displaying code snippets in WordPress. I’ve done a search for a possible pluggin to solve the problem and I’ve come across a plugin called, surprising enough Code Snippet. I’m going to install it and see how good it is.
I’ve had to change the CSS thats supplied with the code snippet pluggin from:
[code lang=”css”]border: 1px solid #ccc;
[code lang=”css”] font: 1.1em ‘Courier New’, Courier, Fixed;
border: 1px dotted #ddd;
margin: 15px 30px 0 10px;
display: block; [/code]
As you can see it doesn’t look too bad, I’ll continue to use it and with luck won’t find any problems with it. Going to have to change all the rest of the blogs that have code in them to match this one. Just about to go through the rest of the code blogs and change the format a little.
Supported languages are
- Apache Log
- C for Macs
- CAD DCL
- Microprocessor ASM
- Objective C
- OpenOffice BASIC
- Oracle 8 SQL
- Visual BASIC
- Visual Fox Pro
- copy archive to wp-content/plugins/ directory under your WordPress installation path
- extract the zip file
- when extracted properly you should have following directory structure: /wp-content/plugins/codesnippet
Plugin will not work if extracted or copied in diffrent directory.
To insert code into post, “code” tag is used with lang attribute.
Example: [ code lang=”php” ] < ?php echo $x ?> [ /code ]