Im trying to get tinyMCE for Wordpress to apply a div with a custom sytle to a selection. Im using tiny_mce_before_init. What happens is it adds the div to each list item instead of adding it around the selection This is my style array:
$style_formats = array(
(
'title' => 'columna',
'inline' => 'div',
'classes' => 'bloque_izq',
'wrapper' => true
)
);
And this is the html I want to wrap with the new div
<h2>Entradas</h2>
<ul>
<li>Queso Fresco en salsa</li>
<li>Queso Fresco con Rajas de Chile de Agua</li>
<li>Chile de Agua Relleno de Pollo y Nueces</li>
</ul>
And this is what hapens
<div class="bloque_izq">
<h2>Entradas</h2>
</div>
<ul>
<li>
<div class="bloque_izq">Queso Fresco en salsa</div></li>
<li>
<div class="bloque_izq">Queso Fresco con Rajas de Chile de Agua</div></li>
<li>
<div class="bloque_izq">Chile de Agua Relleno de Pollo y Nueces</div></li>
<li>
</ul>
As you can see, it applies the div to each element, instead of the whole selection. Ive tried using both inline and block, as well as both type of wrappers, and it seems to be doing the same thing. Please help!
Try changing the inline
argument to block
(use one, not both), that should take care of it. A description of the arguments is available in the Codex.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With