WordPress–Add Text To Single Scrolling Line

While working on another post and attempting to insert code, I came across the problem of not being able to insert single lines of code on one line within WordPress.  This ends up displaying a confusing, multiple line display of what should only be one line of code.  The solution for this was to first install the WP-Syntax plugin.  Then, when typing out lines of code that need to retain formatting, wrap your text in <pre lang=”text”> (or whatever language you want; the WP page for that plugin lists all of the available options) and </pre> tags (in HTML view).  This will output your text just as you entered it, meaning if you’ve been working in the Visual Editor, and your quotes are now displayed as &quot;, you need to change them back to “”.

An example of incorrect display is:


And corrected:


Leave a Comment

Your email address will not be published. Required fields are marked *