Only show certain styles and blockformats in WordPress tinyMCE advanced editor.
2011-04-06 | WordpressA nice little function I found to restrict which styles backend users can apply to text when using the editor in WordPress. Bear in mind that this requires the TinyMCE advanced plugin for WordPress. All I have done is extend on the function I found to add in the “styles” selector and provide the user with a CSS style that I have coded into my themes styles.css
Simply add the following function to you theme’s functions.php (usually at the bottom is best):
/*
* Modifying TinyMCE editor to remove unused items.
*/
function customformatTinyMCE($init) {
// Add block format elements you want to show in dropdown
$init['theme_advanced_blockformats'] = 'p,h5';
$init['theme_advanced_disable'] = 'strikethrough,underline,forecolor,justifyfull';
$init['theme_advanced_buttons2_add_before'] = 'styleselect';
$init['theme_advanced_styles'] = 'First Paragraph=subP';
return $init;
}
// Modify Tiny_MCE init
add_filter('tiny_mce_before_init', 'customformatTinyMCE' );
As a quick description of the function:
- reduces the blockformats to Paragraph and h5 tags
- disables the strikethrough, underline, forecolor and justifyfull options
- adds the “styleselect” drop-down to the second row of buttons
- gives the user one style called “First Paragraph” to use in the styleselect drop-down
- adds the class “subP” to anything styled with “First Paragraph”.
Thanks for sharing, it truly is a really informative publish and very helpful for some kind of businesses like mine. I like when I’m looking the world wide web and i come across a site with valuable points like this. Thanks lots for the research, We’ve noted a number of them here so I can use them in a future. Kudos for you and keep up the good blogging perform.
You actually make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complex and extremely broad for me. I am looking forward for your next post, I'll try to get the hang of it!
Congratulations. I don't know why your website is not ranking higher in google. It should be the first page
Awesome post! I will keep an on eye on your blog.
I just couldn't depart your site before suggesting that I extremely enjoyed the standard info a person provide for your visitors? Is going to be back often in order to check up on new posts
Like the blog
Very great site thank you so much for your time in publishing the posts for all of us to learn about.
Great article! I loved the insight and also the information given . In addition, your writing style is very fun to read. If you have time please take a look at my new blog and tell me what you think.
Excellent ! hey I stumbled on to this writings! even while researching the page for random downloads. thank you sharing I am going to electronic mail my close friends about this as well.
Great article! I loved the knowledge and the information given . In addition, your blogging style is very pleasing to read. If you have enough time please take a look at my new website and tell me what you think.
This is cool!
Wonderful post however , I was wanting to know if you could write a litte more on this subject? I'd be very thankful if you could elaborate a little bit further. Appreciate it!
This really answered my drawback, thanks!
Hi, I just stopped by to visit your site and thought I'd say I had a great visit.
I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post.
Very interesting info!Perfect just what I was looking for!