Array value ‘content_css’ is not enough, TinyMCE can’t simply get the classes from the custom.css file. You need to define the list of styles you want in the dropdown:
function my_format_TinyMCE( $in ) {
$in['content_css'] = get_template_directory_uri() . "/custom.css";
$in['importcss_append'] = TRUE;
$in['style_formats'] = json_encode(array(
array('title' => 'Title for Style #1', 'classes' => 'example-class'),
array('title' => 'Title for Style #2', 'classes' => 'example-class-two'),
));
return $in;
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );
For the full format of what can be included in the ‘style_formats’, check out TinyMCE documentation: Style Formats in TinyMCE. Make sure it has to be in JSON format (that is why I used the json_encode function.
Related Posts:
- Forcing reload of editor-style.css
- How can I insert HTML attributes with an existing TinyMCE button?
- TinyMCE: adding CSS to format dropdown
- How do i use fontawesome icons in TinyMce editor?
- How to add a class to ul tags created by the WordPress editor Tinymce?
- How to make float element in tinymce
- WordPress stripping out BR tags, need assistance
- Different css rules for TinyMCE and Gutenberg while using add_editor_style()
- Inline Style attribute getting stripped off
- Custom styles dropdown in TinyMCE editor – not working with headings
- jQuery UI styles conflicting with TinyMCE dialog
- How to sync the style in the visual editor with the style of a child theme?
- How do I get access to the CSS Editor
- How to style text in WordPress
- How to add class to an html output element in tinyMCE paragraph drop down menu
- Customizing the Post/Page Editor in Classic Editor
- How can I add a stylesheet to the Classic Editor page?
- TinyMCE on frontend style not working
- How to adjust text’s width and put it at center of post (Visual) editor?
- Add WordPress Core CSS into editor-style.css
- How do I change TinyMCE button “i” to create a i tag rather than em? [duplicate]
- Bullet List Indentation not showing up in the wordpress
- Enqueue MCE Editor CSS in admin page
- What is WebKit and how is it related to CSS?
- How can I vertically center a “div” element for all browsers using CSS?
- How to override the properties of a CSS class using another CSS class
- CSS display: inline vs inline-block
- Aligning two divs side-by-side
- How to center HTML5 Videos?
- Text border using css (border around text)
- Is there an opposite CSS pseudo-class to :hover?
- U8Qtu
- How can I transition height: 0; to height: auto; using CSS?
- Display Images Inline via CSS
- Using margin / padding to space span tag from the rest of the p tag
- Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1
- How to change version of .css in WordPress?
- Style something only on the home page
- Why isn’t my theme processing SASS?
- Trying to load a responsive CSS media query using Custom Taxonmy
- Deregister CSS style link ‘open-sans-css’
- tinyMCE duplicates previous block element when pressing return (visual editor)
- Enable Visual Editor In Comments On CPT Edit Page
- How to load different css file depending on language
- I want to change my post titles from h2 to H1
- Change logo on specific page id using css
- Write text below a specific part of a sentence
- Style classic editor buttons
- Layer post title on top of image WordPress featured thumbnail image
- How to have custom tinyMCE buttons break onto next line when too long
- Twig + wordpress – how to get filemtime for style.css
- Inconsistent `body_class()` function
- How to Add Custom CSS to the Media Thickbox?
- Link theme options page using ACF to styles
- WordPress Light/Dark Theme best practices? Is there a way that really works?
- How to i style the elements from the TinyMCE
- How to change H1 color only for pages [closed]
- Background image reversed on pages after home page [closed]
- How to get an unique identifier for a page/post/category/tag etc.?
- Remove CSS Attribute by Overriding CSS in Child Theme
- CSS gap issue in div element
- WordPress custom CSS file overrided by internal CSS [closed]
- Can you change the color of svg icons to the global color I choose from WordPress
- After moving my site, sub-menus are not showing [closed]
- cookie free subdomain and @font-face
- Adding elements to wp_list_pages (within , but before )
- Why doesn’t WP recognize images in posts like other content? [closed]
- CSS isn’t rendered on a post but just posted as text [closed]
- How would I create the same popup in css and javascript as the one in contact button on the site https://www.sublimotionibiza.com/es/main.html [closed]
- CSS for the main top menu appears to have stopped working after All-In-One Migration transfer
- clasic editor – article categories customization?
- How to use css only H2 Tag? Site is considering website title also H2 tag and changing its style as well
- How to edit CSS style sheet after migrating from local
- Dequeing Parent Fontawesome Deques Parent Styles
- wp_list_pages two columns
- How to change hover link colour for blog post (body) text only
- Problems styling a Custom Link in a Menu
- Font .woff files loaded don’t correspond to the displayed styles [closed]
- CSS transition from 0px width to 100% width
- Style not being applied to newly installed themes
- Custom CSS rule overridden in theme
- Twenty Fourteen: Shrinking header while scrolling down
- Style sidebar for a custom page template exclusively
- CSS ?ver=4.7.3 not found
- Custom CSS rules only apply to home page
- Sticky Button not working WP. But does it JS Fiddle
- How to enqueue google fonts if we use directly in style.css
- Trouble with adding preloader to my home page index.html and index.js
- How to change in css with a custom theme?
- Wesbite super slow on iphone / very fast on desktop with same connection on wifi
- How can a left and right margin be added to the admin bar without access to “…wp-includes/admin-bar.php”?
- How to implement styling of div in the front end using plugin admin meta box settings?
- WordPress Custom Superfish CSS Problem [closed]
- Browser stacks different versions of style.css
- Is it possible to make invisible a div only on certain pages using CSS?
- What CSS selectors to know for WordPress? [closed]
- MY CSS FILE IS MISBEHAVING. IS NOT WORKING WELL ON MY WP SITE [closed]
- How enqueue CSS out of theme folder?
- Styling not refreshing for old visitors on WordPress
- What is unsafe about this CSS?