Remove line breaks from <code>?

This code form HTML editor:

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

Returns:

Read More
[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.

Related posts

Leave a Reply

1 comment