Code snippets

Adding code snippets to WordPress

  • Search plugins for syntax.
  • Install Crayon.
  • Read documentation.
  • Use <pre> tags in “Text” mode as shown below.


<pre class="lang:swift" title="A snippet of code">
import UIKit
class SampleClass: NSObject {
var variable:Double
}
</pre>

  • End up with something like this:
import UIKit

class SampleClass: NSObject {
    var variable:Double
}

It’s that easy!