Unwanted paragraph tags in WordPress posts
During my tinkering with the template for The Beta Blog, I ran into a whole load of problems with trying to get the green CTA “Continue reading” links working.
As soon as I styled the links with a coloured background I could see two blocks of green. One being the link, the other being a little square of green directly at the end of the last paragraph of text.
Turned out that the auto paragraph function of WordPress – which inserts <p> tags in both Visual and HTML editing modes – was really messing up the code. It ended up having paragraph tags sandwiching the closing <a> tag for the “more” link!
<a href="http://beta.beantin.se/" class="more-link">
<p>Continue reading »</p>
It wasn’t a solution to turn off WordPress’s parsing of HTML mode as I still wanted functions such as “more” to work.
The solution I found, although i’m not 100% happy with it, was to install a plugin called Raw HTML. The plugin does exactly what it says it will, but in order to get my index page and “more” links to work I have to remember to check “Disable automatic paragraphs” on every post. There’s no option to set it as default.