I came across an IE display issue with my portfolio recently where the divs of the individual projects were ‘staircased’ down the page, with a whitespace break of about half the height of the div between the top of the previous project and the top of the next one. It was irritating, and I couldn’t figure out what was causing it until I examined the source code that the browsers were generating and discovered WordPress was automatically inserting <p> tags around certain other tags (even in HTML view in the visual editor!), which IE was interpreting as whitespace.
A quick bit of googling came up with a couple of different solutions which I’ve listed below.
After sifting through more code than I’d like to admit, I figured out a very quick and easy fix that doesn’t seem to break anything else (on my site anyway). All you need to do is open the /wp-includes/default-filters.php file and comment out the following line:
addfilter('the_content', 'wpautop');
From justinblanton.com.
(Note: to comment out a line in a PHP file, insert two forward slashes in front of the line.)
By default, WordPress automatically inserts paragraph tags all over the place when displaying ‘the_content’ – this often gets in the way when you’re trying to space out your text, and also creates validation issues (inserting implicit <p>). If you want to strip the automatically inserted paragraph tags from your content, simply insert this line in your template file above ‘the_content’ tag:
<?php remove_filter (’the_content’, ‘wpautop’); ?>
You are amazing! This was exactly what I was looking for. Thanks a million for your help!
Cheers!
No problem Ryan, glad it helped you out.
Unfortunately it strips even the P tags that I add….very weird
Finally! Thanks. It helped knowing which file to edit. You were the only one that made it clear and the p is gone. Thanks again.