Adding code to be displayed to viewers in a Page or Post on a WordPress.org Website (i.e. self-hosted WordPress) is complex. I’m not referring to adding code or script to be executed but rather displaying the full code/script to the viewer. The visual editor in WordPress strips out all the code ‘descriptors’; its therefore necessary to add and code to be displayed (but not executed) into the HTML editor using the <code> and/or <pre> HTML tags.
- Install and activate the SyntaxHighlighter Evolved Plugin.
- In your Page or Post visual editor merely add [sourcecode language=”css”]
your code here
Obviously change ‘language=”css”‘ to whatever language/code/script you’re using.