Reputation: 2799
Searching this topic comes up with custom plugin solutions but I'd prefer to learn what's involved in doing this 'manually'. The problem:
I have a snippet of HTML which includes a form (an Amazon Payments Donation button) which I'd like to insert into one of my Wordpress pages. When I do it in the Text editor, it quasi works but the resulting code gets seriously modified by Wordpress.
For instance, a <br></br>
gets added after each hidden input element, and some extraneous <p></p>
elements get slotted in as well, making the resulting div huge, full of white space (that's impossible to correct via CSS alone).
What would be a non-plugin fix, or is it even possible?
Upvotes: 0
Views: 207
Reputation: 160
You can try cleaning the p and br tags from the content
simply add this to your functions.php file
function clean_shortcodes($content){
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'clean_shortcodes');
Hope it helps :)
Upvotes: 1