need help getting code tags to work in WP for tutorial

Discussion in 'HTML & Website Design' started by dbonline, Jan 24, 2010.

  1. #1
    Hey everyone, I'm trying to do a basic CSS tutorial post on one of my new Wordpress blogs but for some strange reason the <code></code> tags are not working. Everytime I go to preview the tutorial the CSS code I entered between the code tags shows up as blank. I've tried everything possible I can think of. I've tried writing the post/tutorial using both the visual and HTML option, yet still no luck. I've also searched Google to find a solution and nothing seems to help.

    Several search engine results lead me to sites/forums that suggested using the following in my WP blog post:

    [sourcecode language="css"]
    your code here
    [/sourcecode]

    ...yet that doesn't work either.

    What the heck could be causing this to happen? I just want to write a simple CSS tutorial for beginners and I can't even get the darn code to appear!!!

    Any help would be greatly appreciated!!
     
    dbonline, Jan 24, 2010 IP
  2. MmmDesign

    MmmDesign Peon

    Messages:
    185
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Don't know if you've seen this in your search, but wordpress themselves have a pretty thorough explanation of how to include <code> in your posts.

    http://codex.wordpress.org/Writing_Code_in_Your_Posts#Resources

    Read through it but basically it comes down to needing the <pre> tag as well as character entities for things like the < , > , / , etc...

    At the bottom of their guide is a list of plugins that make the whole process easier if you plan on including tons of <code> on your site.


    Update: Just played around with it on a test blog. The [/sourcecode] tag will work just fine if you include the <pre> tags... something like this:

    <pre>
    [sourcecode]
    <p> This is a test </p>
    <h2 id="ninjas">NINJAS!</h2>
    [/sourcecode]
    </pre>
     
    Last edited: Jan 25, 2010
    MmmDesign, Jan 25, 2010 IP
  3. dbonline

    dbonline Well-Known Member

    Messages:
    401
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    128
    #3
    thanks MmmDesign, after spending countless hours trying to get it to work properly with just regular <pre> and [sourcecode] tags I finally decided to use a plugin for this and it works great. Problem solved!
     
    dbonline, Jan 26, 2010 IP