The ins and outs of code blocks in WordPress content

Categorized under:

Photo of author
Written By Brian Krogsgard

5 thoughts on “The ins and outs of code blocks in WordPress content”

  1. I was thinking of a meta box approach so you could write code snippets for a post in dedicated code editors inside that metabox. The downside is then relying on short codes to insert it into the content. Thoughts anyone?

    • A commenter on Chris’ post recommended the same. Any third party solution also requires shortcodes. Not a bad idea, in my opinion. But it’d need to be a repeatable field for handling multiple code blocks. And it could be a bit unsightly to have that metabox on every post edit screen if you don’t post code that often.

      • I’m going to work on a metabox / editor button combo solution I think. It would indeed be repeatable fields, but they wouldn’t show until you decide you want to write code on a particular post (so no unnecessary clutter). One of the things I look forward to is being able to use tabs and indent without wrestling with the editor.

        I do like and jsfiddle too.

    • I wonder if an added button to the TinyMCE editor might be even better. It could still work on a shortcode, but it’s a bit more “inline” of a concept.

  2. +1 for Gists. I’ve fought many of the Syntax Highlighter plugins and maybe it’s just me trying to simplify my life, but my last post I used WP Github Gist that uses the [gist] shortcode and was simple flexible and worked. It allowed me to combine all the snippets into 1 Private Gist and looked really good. I would definitely like to suggest the author add a TinyMCE button so I don’t have to remember the parameter names, but still works great!

Comments are closed.

A2 Hosting