WordPress TinyMCE : Wrap several elements in DIV

Problem: User wants to know if it is possible to wrap multiple items in a div by using TinyMCE? He wants to avoid using a shortcode.
Here is a setup:

$style_formats = array(
‘title’ => ‘Title with list’,
‘block’ => ‘div’,
‘classes’ => ‘my-class’,
‘wrapper’ => true,

The result:


  • Some text...
  • Some text...
  • Some text...

But he wants to has something like this:


  • Some text...
  • Some text...
  • Some text...

Solution 1:
I think you have to use a different method to do this. Based on the documentation here:

Take a look here:

And Here:
I haven’t actually done this – I just spent some time researching it a while ago for a client.

Solution 2:
After slightly modified the code User has what he wanted.
He also added a button to remove the div.
Here is the method:

Above problem is solved by user himself so 2nd solution is correct.but if you have any other idea to solve this problem you can do that. Be creative.

One thought on “WordPress TinyMCE : Wrap several elements in DIV

Leave a Reply

Your email address will not be published. Required fields are marked *