Beef up TinyMCE in WordPress with the style selector

Adding another

Suppose you wanted to add another style. Maybe you want to apply a class to a paragraph. Simply add another array, like so:

In this case, I used 'selector' => 'p' instead of 'block' => 'p'. That’s because the <p> tags are already in place in TinyMCE. Using selector tells TinyMCE to apply your styles (in this case a “no-indent” class) to an existing selector.

Summing up

Phew! That’s quite a lot. Fortunately it’s very easy to understand, and it’ s all well-documented on the TinyMCE website (the format of the code is different, but the meaning of the various pieces and parts is consistent). The style selector is a very powerful way to simplify your clients’ workflow—and maybe your own workflow as well. It makes it painless to consistently apply complex styles to content, meaning happier clients and happier designers!

Pages: 1 2 3 View All

1 Comment »

  1. Dennis Gaebel wrote:

    Sweetness! Giving it a whirl right now. We shall see how I do. I’ll report back for sure.

    Comment — March 26, 2013 @ 12:52 am

Leave a comment