Written by James McDonald

February 17, 2009

I have been attempting to use the <pre> tag to simply copy and paste information into WordPress but the result has been that it doesn’t accept all the whitespace as being whitespace.

Anyway I installed WP-Syntax plugin and attempted to insert some code and it had all the code on the same line – no line breaks at all.

WP-Syntax uses <pre> to define where code begins and ends so I traced the problem to the style.css file which had:

pre {
  white-space: normal; /* why pre? */

The fix is to comment out the css for the pre element.

/* pre {
  white-space: normal; 

style.css is located in the wp-content/themes//style.css

Once the css is commented out WP-Syntax then displays code as it should.

1 Comment

  1. r3dux

    Good hack! Worked a treat for me – much appreciated!



  1. How To: Compress a Directory of Files into Individual Archives | r3dux.org - [...] and cheers to James McDonald for his WP-Syntax hack to stop all the embedded code appearing on a single…

Submit a Comment

Your email address will not be published.

You May Also Like…

Adding BCC to Divi Contact Form

The Divi contact form allows you to send to multiple email addresses by opening the properties of the form and...