Im having a problem where WP for some odd reason is stripping out my BR tags. Ive looked online and have read a few solutions that people offered including the installation of TinyMCE advanced plugin and still….the same thing.
The problem is that not matter what i do, even if i go to the html tab and manually insert a br tag, it isn’t creating any space between content. The code im testing now is this below:
The code that has this looks like this
this is sentence one<br>
this is sentence two <br/><br/>
this is sentence three
this is sentence four
which should appear like so
this is sentence one
this is sentence two
this is sentence three
this is sentence four
but when seen on WP front end, it shows like a long sentence.
here is the link: http://tightlineinternetmarketing.com/mike-dev/thp2/?page_id=1930
Also on that page, whilst testing, you will see that the same code i put on that post, i hard coded it onto the page.php just to test. and the hard coded part appears as it should whilst the same code but generated from WP does not appear as it should.
its driving me nuts.
I even installed another version of WP on my local wamp environment and still the same problem. I’ve also tested code on W3C validator(s) (html/css) and no real errors (except 3 from the nav menu which are minor).
Any help is GREATLY appreciated.
EDIT**
this is the post loop im using
<?php
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="midSecContActual">
<h1 class="page-title"><a href="<?php the_permalink();?>"><?php the_title(); ?></a></h1>
<!--<div class="entry-date"><?php the_date(); ?></div> -->
<div class="theContent"><a href="<?php the_permalink();?>"><?php the_excerpt(); ?></a></div>
</div><!-- midSecContActual ender -->
<?php endwhile; endif; wp_reset_postdata(); rewind_posts(); wp_reset_query(); ?>
Don’t use
the_excerpt()
if you want to have line-breaks 😉I’m guessing this is a custom field you are referring to?
You haven’t posted any code, but however you are outputting the content that is incorrectly formatted, wrap it in wpautop:
Otherwise, WP will ‘helpfully’ strip out
br
tags from your code. wpautop will convert doublebr
s into paragraphs, and the second parameter, when set to true, tells it to leave singlebr
s in place.See the codex for more.
I had the same issue and I fixed by installing TinyMCE Advanced. After you install this plugin, you just go to the plugin settings and enable the option to stop removing
tags and others.