0

Can anyone advise on how I can remove the preceding <br> tag when a post's "read more..." tag is generated?

Any advice appreciated!

This is the code that's generated -

<p>blah blah blah blah<br>
 <a class="more-link" href="blahblahblahblah"> …Read more</a></p>

It's that annoying little
I want rid of, so the "read more" is on the same line...!

4
  • Check out this answer of mine on "more span making trouble" question, I am not sure if you are referring to same issue as that question.
    – Rarst
    Dec 20 '10 at 11:29
  • Thanks for your reply, but the code being generated for me isn't in a span, it just has <br> then an anchor tag for the read more. Should there be a span around it?
    – Cordial
    Dec 20 '10 at 11:36
  • 1
    @Cordial: Please add the fragment of your theme that inserts the more link to your question. Please name the theme you are using.
    – hakre
    Dec 20 '10 at 14:52
  • 2
    @Cordial does adding blank lines around more tag, as described in that answer, in editor help?
    – Rarst
    Dec 21 '10 at 7:43
2

Can you show us your generated source code with more tag and code which you use for this?

UPDATE

Try this:

function clear_br($excerpt){
return str_replace("<br>","", $excerpt);
}
add_filter('the_excerpt', 'clear_br');

Paste this code in your functions.php

0

You'll wanna make a filter in your functions.php file. Scroll about halfway down on this codex page and they'll show two separate methods.

the_excerpt on WordPress Codex

Also, make sure your existing functions file doesn't already have something like this, which could be adding the line break in the first place.

Your Answer

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