How to Display Code in Post

Community Forums Forums Design Tips and Tricks How to Display Code in Post

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  chantal2012 1 year, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #46358

    chantal2012
    Participant
    Post count: 60

    I’m writing a tutorial on my site and I need to be able to display HTML and CSS code for the purpose of the tutorial.  How do I embed code so it actually shows up the way that I wrote it with line numbers next to the code so that my visitor can simply copy and paste the code?

    #46366

    braddalton
    Participant
    Post count: 9759

    Many ways to do this but be careful.

    I think Github Gists is the best.

    Used by all the Genesis Developers


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #46370

    chantal2012
    Participant
    Post count: 60

    I tried using that but I didn’t know where or how to put the “embed” link into my post…I tried everything but it didn’t work.

    #46374

    braddalton
    Participant
    Post count: 9759

    You simply grab the embed link from Github Gists and paste it in your text editor.

    Try it.

    1. Click on This Gist link above
    2. Copy from the Embed This Gist
    3. Paste the one line of script into your text editor and click save
    4. View this post to see the result.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #46407

    chantal2012
    Participant
    Post count: 60

    Thanks Brad…that worked…I don’t know what I was doing wrong before!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.