Ever searched for code to change your WordPress website? When you found that thread or blog post, you grabbed the code snippet you needed. It was easy.
How did that blog post share the code, anyway?
Path 1
As I find snippets, I like to share them. But how?
One way to begin adding code to your site is wrap the code in <pre> tags. In your stylesheet, add
pre { font-family: monospace; color: #777; }
Path 2
But <Pre> only goes so far. Soon I was looking for another solution. I tried using plugins to share code, but they seemed clunky. And the code snippets didn’t look nice.
Then I found GitHub.
I admit, I didn’t understand it at first. I tried a few times and gave up. Then I met Carrie at WordCamp US a year ago (meeting her in person was exciting!), who encouraged me to try again, and blog about it.
So I did.
And Github turned out super simple.
First, make a gist. You don’t have to sign up or have an account.
Then, look for the Embed dropdown menu and copy (just double click it) the code beside it (starting with <script…)
Paste that code into your WordPress post (Text view, not Visual) and save your post.
Voilà!
[…] Congratulations! You’ve just published your gist! See how to embed this gist on your WordPress website. […]