Found Image http://plugins.svn.wordpress.org/tinymce-custom-styles/assets/icon-256x256.jpg TinyMCE Custom Styles | Plugin Review Network Skip to Content

Plugin Review Network

Plugin Review Network

an eye on the best wordpress plugins
Show Sidebar Hide Sidebar
[+] Sidebar [-] Sidebar
Plugin:
Rated:
82%
4.1 Stars (9 votes)

Home

WP.Org

ReadMe

Support
  • Author:
    Tim Reeves (original author David Stöckl)
Version: 1.0.9
Requires: WP 3.0.1
Last Updated:1808 days ago
Downloads:36488
Installations: 2,000+
Tags:
    editor, Format, Style, TinyMCE, visual
Download Plugin Package

TinyMCE Custom Styles

Released on June 28, 2016.
Download Plugin Package

Version: 1.0.9

Enhance TinyMCE visual editor with a dedicated stylesheet, a stylesheet shared with the frontend, and custom styles in the Formats dropdown.

  • Description
  • FAQ
  • Changelog
  • Installation


Please someone take over maintaining this plugin, or it will get abandoned - with over 9.000 active installations.

I'm now 69 and although retired, all my time is taken up with other projects, while I still have the energy for them. Why you might want to take it over? It's really useful:

Make your editing experience as simple and good as possible by improving the way you work with the TinyMCE visual editor (including Gutenberg Classic block). This plugin adds custom CSS file(s) to the frontend and to the TinyMCE editor; and it allows you to populate TinyMCE's 'Formats' dropdown with your own styles. The features in more detail:

1. Installs two CSS stylesheet files into your chosen location (so you can still do updates of the active theme and this plugin and even switch to another theme). In general you will need to fetch the auto-created stub files via FTP, edit them locally and upload them, overwriting the previous versions.

  • editor-style.css is used for styling your TinyMCE Editor
  • editor-style-shared.css is used for styles to be used by the frontend AND in your TinyMCE editor (so you do not have to copy)

To use this feature, you have to write your own CSS code into these files.

2. The main feature of this Plugin is to offer a Backend-GUI to create custom styles for TinyMCE ('Formats' dropdown) dynamically.

  • Easy to add, change and delete styles
  • No editing of source code required (excepting the CSS stylesheets)
  • Allows you to add block- and inline elements which are not provided by TinyMCE, e.g. <figure>, <cite>, <q> etc.
  • The plugin's backend page contains a lot of description and some links to help you define your styles correctly
  • Note that each style can have both CSS Classes and/or CSS Inline-Styles. The latter (excepting color) will even be applied to the Formats dropdown menu items. However, I do not recommend inline styles as they are inserted into the text of the post/page and remain unchanged if you later alter the style in the plugin settings - so in general stick to Classes!

How the two stylesheets are applied The shared style sheet file is enqueued to be included on frontend pages (via the usual <link> tag in the <head> area) using the standard WordPress function wp_enqueue_style.

So, as with most other stylesheets, the statements in it will automatically apply to the whole HTML page. So define class names which will not collide with any already in use by the theme – and do not define styles for HTML elements without a limiting class name unless you want them to apply to all elements of that tag type (including in header, footer, sidebar...).

Both stylesheets are passed to TinyMCE by calling: add_filter(‘mce_css’, …)

What this causes to happen is that they are linked in to the HTML document which is the source for an <iframe>, which is the editing area of TinyMCE. So they should definitely only apply to HTML in the iframe - although I have heard that some situations, e.g. a cache plugin, may break this mechanism.

Gutenberg classic blocks As of version 1.1.1 this plugin works for the Gutenberg classic block.

WordPress MultiSite Although it does not check for MultiSite, the plugin works in the MultiSite environment, since WordPress uses a separate Options table for each MultiSite. You can reuse the same CSS files (by supplying the same custom directory in each Site), or add separate ones for each Site.

Current Languages - en_US - de_DE (Tim Reeves)

I cannot edit editor-style.css and editor-style-shared.css. What is wrong?

The Plugin was probably not able to create the files, due to problems with your server filesystem settings. Please create these files in the selected directory manually, and make sure the directory read/write access is set to 777.

I have edited the files editor-style.css and editor-style-shared.css, but my visual editor is not styled. What is the problem?

  1. You should empty the cache of your Web Browser, this is often the reason for the styles being applied with some delay.
  2. Check this with simple styles like body { background-color:black; } to see if it basically works.
  3. Maybe there are some functions inside of your Theme / other Plugin, which overwrite the settings of this Plugin. Please check this out as it seems to work in most cases.

The file editor-style.css is not working in the frontend of my website, but it is applied to the backend editor. Why?

Make sure that your Theme calls the function wp_head(); inside the header of your template.

I have created some custom formats/styles, I can see the dropdown, but the formats/styles which I have created on the settings Page just do not work. What is wrong?

You have to be careful when creating custom styles if you are doing it for the first time. If you make a row with an HTML blockquote element and you choose "Inline" from the radio buttons, this style will NOT work, as blockquote is not an HTML inline element.

Try something easy like: - Name: My red text - Type: inline - Type value: span - CSS style: color / #f00

Check if this style works. If so, proceed to other styles. They will only work if you use correct semantics.

Does it work with shortcodes?

In general, no, because the shortcode is only expanded to HTML in the frontend - in the backend (editor) the shortcode is normally displayed as a shortcode, to allow it to be seen and edited (e.g. change shortcode parameters, position on the page etc.). Styles in editor-style-shared.css which match the HTML generated by the shortcode will of course work - in the frontend. There is no point putting such styles in editor-style-shared.css, so if you prefer, put them in the themes custom CSS (if provided, but not WordPress customizer, as that inserts the CSS inline on every page).

What about media from the media library?

An image for example, when inserted via the media library, will show as the [caption] shortcode in the "Text" tab of the editor. To allow the page to be viewed visually, an exception is made and on the visual tab the image and caption are displayed, as TinyMCE itself replaces the shortcode with HTML. The HTML generated by TinyMCE (div dl dt a img br dd) is very different to that generated by WordPress at the frontend (div a img p). So in general, I recommend to use the text tab to fix image styles / encapsulation - my experience is that it's a real hit and miss affair with styles in the 'Formats' dropdown (more miss than hit).

1.1.5 (2023-08-05)

  • Security - Overzealous sanitization relaxed to allow "/" in directory path input

1.1.4 (2023-06-06)

  • Security - More sanitize and escape admin panel settings inputs, as requested by Jetpack Support

1.1.3 (2023-01-27)

  • Security - Sanitize and escape admin panel settings inputs (rawrly)
  • Documentation - Add note in description to report security bugs through Patchstack

1.1.2 (2023-01-24)

  • Removed broken link in credits

1.1.1 (2021-10-25)

  • Bugfix - call of wp_enqueue_scripts corrected to wp_enqueue_style
  • Enhancement - enqueue both stylesheets also as Gutenberg block assets

1.1.0 (2021-04-07)

  • editor-style.css and editor-style-shared.css: Both files must be present or a (non-empty) stub will be created; but if a file is zero bytes long, it will not be loaded / enqueued at all
  • Styles defined for the 'Formats' dropdown which do not have a class now do not create an empty class attribute in HTML
  • Regrouping of items on the settings page to make clearer which elements belong to which functionality
  • Very major rework of the documentation - both in the description page and on the settings page (backend)

1.0.10 (2021-03-07)

  • Fixed a typo which prevented custom style deletion
  • Documented that Gutenberg classic blocks not supported

1.0.9 (2020-07-01)

  • Typo-correction in plugin description

1.0.8 (2018-01-13)

  • Improved plugin description

1.0.7 (2017-12-28)

  • Learned more on SVN and really deleted/added language files

1.0.6 (2017-12-28)

  • Removed unneccesary and outdated translation files

1.0.5 (2017-12-28)

  • Small formal improvements re translation
  • Added .pot string translation file

1.0.4 (2017-08-10)

  • Standard entries and any other previous entries (from other plugins) in TinyMCE's Formats dropdown are now preserved
  • Added a checkbox option to allow inserting the custom styles in a submenu "Custom Styles" in the Formats dropdown
  • Added a checkbox option to govern whether to preserve the standard Formats entries or remove them. This option gets overwritten (to 'preserve') by the 'WP Edit' plugin with option 'Add Pre-defined Styles' checked.
  • Minor updates to german translation
  • Outdated spanish and serbien translations removed
  • Tested and described on WordPress MultiSite
  • Various other improvements in the description

1.0.3

  • Updated german translation
  • Made some table header names translatable
  • Shortened some table input fields for better layout

1.0.2

  • This update improves the settings page as follows
  • Added second save button
  • Complete rework of admin notices
  • Many minor layout and message improvements
  • Corrected several loop counter irritations
  • Improved how missing style files are tested
  • Improved logic and messages around custom directory
  • Added more explanation and sample content in auto-created editor-style-shared.css
  • Reduced PHP Warnings and Notices to zero

1.0.1

  • Initial release as fork.

ToDos

  • Warn admin user when leaving changed settings page
  • Add a JS function to insert a row after another row
  • OR better: Make style rows sortable by drag and drop
  • Nice to have: Rewrite the code from procedural to OOP
  • Get more translations


  1. Upload the Plugin to your wp-content/plugins/ folder
  2. Activate the Plugin
  3. Go to Settings -> TinyMCE Custom Styles
  4. Follow the instructions on the screen - write your CSS and create your custom formats

Important: Some Settings of TinyMCE or certain TinyMCE Plugins require you to do some manual settings for the Plugin to work. The Plugin WILL work, if you configure it correctly - check the FAQ for help.


 

Click here to cancel reply.

Click here to cancel reply.


*

*


Please copy the string FLXCCq to the field below:

Home | Sitemap | Contact
Network Skin Theme for BioShip by WordQuest
Password Reset
Please enter your e-mail address. You will receive a new password via e-mail.