Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This code form HTML editor:

<code>&#91;shortcode&#93;
    &#91;bar&#93;foo&#91;/bar&#93;
    &#91;bar&#93;foo&#91;/bar&#93;
    &#91;bar&#93;foo&#91;/bar&#93;
&#91;/shortcode&#93;</code>

Returns:

[shortcode]<br />
   [bar]foo[/bar]<br />
   [bar]foo[/bar]<br />
   [bar]foo[/bar]<br />
[/shortcode]

Codes white-space is set to pre-wrap in css (and I want it this way) and I'm using this piece of code (works for shortcodes, usually):

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99 );`enter code here`

I don't want to use plugins or delete these line breaks using JavaScript. Any ideas? I can't edit WP core files too (only theme's). I know it's doable because I've seen many premium themes with pretty & clean code sections.

[edit]

Using <code><pre>contents</pre></code> somehow deletes all the <br/> tags from code (why?), but I don't want to add <pre> every time I write some code.

share|improve this question
    
I'm not sure what it is you're asking? Your question takes the form "I have X and I have Y, I'm doing Z" but nowhere have you actually asked a question... –  Tom J Nowell Feb 14 '13 at 16:42
    
I just want to avoid Wordpress doing ANYTHING to my code tags, including adding any html tags and reformatting white space :) –  Wordpressor Feb 14 '13 at 17:38

1 Answer 1

up vote 4 down vote accepted
+50

Wordpress assumes that you use <code> for inline code and <pre> for a box of code. In your case, then, you shouldn't have any need to use <pre><code> but just <pre>

See: Writing Code in Your Posts

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.