1

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 &nbsp;
this is sentence four &nbsp;&nbsp;

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();   ?> 
  • 1
    How are you echoing this? Show us your code. "the_content()", "get_the_content()" ? Seems like its not running through filters properly. Some plugin may be interfering? – GhostToast Aug 13 '13 at 16:34
  • hello GhostToast, i edited my post – somdow Aug 13 '13 at 16:37
  • the_excerpt() won't have line-breaks by default. Refer to Vancoder's answer. – GhostToast Aug 13 '13 at 16:40
  • OMG thats the mistake right there..........i looked at your post @Ghost and im like "what does he mean the_excerpt()??? why would i use that to post content " then the AHA! moment....lol ...sigh, that solved the issue. i somehow used "the_ecerpt" function instead of "the content"....thank you VERY much! – somdow Aug 13 '13 at 16:44
3

Don't use the_excerpt() if you want to have line-breaks ;)

0

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:

echo wpautop($some_long_text, true);

Otherwise, WP will 'helpfully' strip out br tags from your code. wpautop will convert double brs into paragraphs, and the second parameter, when set to true, tells it to leave single brs in place.

See the codex for more.

-1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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