latest stuff | the author | contact

Only show certain styles and blockformats in WordPress tinyMCE advanced editor.

2011-04-06 | Wordpress

A 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:

  1. reduces the blockformats to Paragraph and h5 tags
  2. disables the strikethrough, underline, forecolor and justifyfull options
  3. adds the “styleselect” drop-down to the second row of buttons
  4. gives the user one style called “First Paragraph” to use in the styleselect drop-down
  5. 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.

2011-09-07 21:38:03 | Anxiety disorder

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!

2011-10-23 23:41:38 | baltimore cruises

Congratulations. I don't know why your website is not ranking higher in google. It should be the first page

2011-12-21 17:41:03 | test doscientos

Awesome post! I will keep an on eye on your blog.

2011-12-22 12:06:59 | Sherwood Tortora

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

2011-12-23 03:50:59 | pepeluca

Like the blog

2012-02-23 22:30:23 | Vivian

Very great site thank you so much for your time in publishing the posts for all of us to learn about.

2012-03-22 01:07:13 | window cleaning 47405

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.

2012-03-26 03:49:26 | Rebuild Credit

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.

2012-03-27 08:09:32 | Atlee

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.

2012-03-28 08:34:07 | Rebuild Credit

This is cool!

2012-04-02 22:59:37 | Mildred

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!

2012-04-04 17:09:26 | Darcey Mayon

This really answered my drawback, thanks!

2012-04-12 02:32:46 | Anderson Capestany

Hi, I just stopped by to visit your site and thought I'd say I had a great visit.

2012-04-26 07:24:23 | heart health

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.

2012-04-27 15:47:10 | Ron

Very interesting info!Perfect just what I was looking for!

2012-05-01 00:29:00 | vitamin d

Leave a Reply

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

*

* Copy this password:

* Type or paste password here:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>