Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom style with tinyMCE for Wordpress using tiny_mce_before_init, adds div with style to each list item instead of adding it around selection

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!

like image 679
Elias Escalante Avatar asked Dec 19 '13 20:12

Elias Escalante


1 Answers

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.

like image 130
Steve Grunwell Avatar answered Nov 15 '22 09:11

Steve Grunwell