Custom style with tinyMCE for Wordpress using tiny_mce_before_init, adds a div with a style to each item in the list, rather than adding it to the selection

I am trying to get tinyMCE for Wordpress to apply a custom sytle div to a selection. I am using tiny_mce_before_init. What happens is adding a div to each element of the list instead of adding it around the selection. This is my array of styles:

$style_formats = array( ( 'title' => 'columna', 'inline' => 'div', 'classes' => 'bloque_izq', 'wrapper' => true ) ); 

And this is the html that I want to wrap with a 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 that 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 a div to each element, not the entire selection. Ive tried to use both the inline and the block, as well as both types of wrappers, and it seems to do the same. Please, help!

+6
source share
1 answer

Try changing the inline argument to block (use one, not both), which should take care of this. A description of the arguments is available in the code .

+1
source

All Articles