Image Editor weird div appears for no reason
-
Hi, i’m using bootstrap to get a responsive, design, so i wanna tweak the html for image insertion using the media gallery:
So my php is this:
function html_img($html, $id, $alt, $title, $align, $url, $size ) { $url = wp_get_attachment_url($id); // Grab the current image URL $alternatif = $alt != "" ? $alt : $url; $class = 'img-responsive'; if ( $align === 'left') //$size === 'article_300_left') { $html = '<div class=\'row vertical-align\'><div class= \'col-md-4 col-sm-12\'>'; $html .= "<img src=\"$url\" class=\"$class\" alt=\"$alternatif\"></div><div class=\"col-md-8 col-sm-12 vertical-align\">VOTRE TEXTE ENTRE CES DEUX BALISES</div>/<div>" ; } return $html; }
When editing from text, i see this added to the page:
<div class='row vertical-align'><div class= 'col-md-4 col-sm-12'><img src="https://127.0.0.1/wordpress/wp-content/uploads/2015/07/inchallE3.gif" class="img-responsive" alt="https://127.0.0.1/wordpress/wp-content/uploads/2015/07/inchallE3.gif"></div><div class="col-md-8 col-sm-12 vertical-align">VOTRE TEXTE ENTRE CES DEUX BALISES</div>/<div>
but if i go back to visual and than to text, the actual code is this:
<div class="row vertical-align"> <div class="col-md-4 col-sm-12"><img class="img-responsive" src="https://127.0.0.1/wordpress/wp-content/uploads/2015/07/inchallE3.gif" alt="https://127.0.0.1/wordpress/wp-content/uploads/2015/07/inchallE3.gif" /></div> <div class="col-md-8 col-sm-12 vertical-align">VOTRE TEXTE ENTRE CES DEUX BALISES</div> / <div></div> </div>
Why the hell is wordpress adding this / and this opening div tag?
It messes with my page layout, and it’s not w3c validated anymore.Can someone help?
- The topic ‘Image Editor weird div appears for no reason’ is closed to new replies.