Reputation: 4859
I try to add this HTML inside a Wordpress page in Text tab:
<div class="homepage-section-row" style="margin-top:5px">
<a href="#">
<p>Test</p>
<span class="icon-comment-alt fblock-icon"></span>
</a>
But when I see the page source, I see some extra tags:
<div class="homepage-section-row" style="margin-top:5px">
<a href="#"><p></p>
<p>Test</p>
</a><p><a href="#"> <span class="icon-comment-alt fblock-icon"></span><br>
</a>
</p></div>
I'm using Wordpress 4.1. What should I do?
Upvotes: 1
Views: 1016
Reputation: 78676
In Wordpress text editor, any block level like <div>
<p>
<ul>
elements will be reserved, any inline elements like <a>
<span>
will be automatically wrapped in to <p>
tags if there are line breaks surrounded.
What you could do is make everything one line:
<div class="homepage-section-row" style="margin-top:5px"><a href="#"><p>Test</p><span class="icon-comment-alt fblock-icon"></span></a></div>
OR this is also acceptable:
<div class="homepage-section-row" style="margin-top:5px">
<a href="#"><span>Test</span><span class="icon-comment-alt fblock-icon"</span></a>
</div>
OR update the html tags if you want to have multiple items:
<ul class="homepage-section-row">
<li><a href="#">Test 1</a></li>
<li><a href="#">Test 2</a></li>
</div>
Upvotes: 2
Reputation: 1686
It's called wpautop. I also find it incredibly annoying, but when you have a website with a lot of writers, it is very useful.
Here is a plugin I have used to turn it off - HTML Markup Editor
Upvotes: 1