Custom Style names assigned in functions.php file are gone
-
The old way of adding custom styles to a separate stylesheet and naming them in functions.php is not working since the upgrade to 4.0.1.
I have a ton of clients’ websites out there that have this code in use, and from what I can see, it no longer works so is there a new way to rename those styles? I can’t have clients searching for html code in the Formats dropdown menu.
For instance, a custom style we use on one site is “Star Bullet List” not “ul.star” they won’t know what that means.
Also, the list item itself was never in the editor.css stylesheet, so no “ul.star” just the “ul.star li” was there, and that caused it to go missing from the Formats dropdown menu. If you don’t add a parent css style, then that item is gone, because TinyMCE now ignores your custom stylesheet and functions.php file. To fix this one, I had to add a ul.star style to the editor css stylesheet.
So here’s my question – how do you name the styles in the Formats menu now?
This is my original code in the functions.php file:
/* Custom CSS styles on WYSIWYG Editor - Start ======================================= */ if ( ! function_exists( 'myCustomTinyMCE') ) : function myCustomTinyMCE($init) { $init['theme_advanced_disable'] = 'fontselect, fontsizeselect, forecolor, backcolor, forecolorpicker, backcolorpicker'; // Removes the undesired buttons $init['theme_advanced_buttons2_add_before'] = 'styleselect'; // Adds the buttons at the begining. (theme_advanced_buttons2_add adds them at the end) $init['theme_advanced_styles'] = 'Quote Name=quotename, Narrow Yellow Button=narrow-button, Wide Yellow Button=wide-button, Wide Orange Button=orange-button, Star Bullet List=star, Left List=left, Right List=right, Reviews Quote Name=reviews-name, Blue Text=blue, Yellow Text=yellow, Orange Text=orange'; return $init; } endif; add_filter('tiny_mce_before_init', 'myCustomTinyMCE' ); add_filter( ‘mce_css’, ‘tdav_css’ ); add_editor_style('mycustomstyles.css'); // including the Custom CSS on our theme. function mycustomStyles(){ wp_enqueue_style( 'myCustomStyles', get_bloginfo('stylesheet_directory').'/mycustomstyles.css', '','','all' ); /*adjust this path if you place "mycustomstyles.css" in a different folder than the theme's root.*/ } add_action('init', 'mycustomStyles'); /* Custom CSS styles on WYSIWYG Editor - End ======================================= */
This uses a custom stylesheet named “mycustomstyles.css” and names some styles for the client, such as “Star Bullet List” and “Right List” and “Blue Text” and this is how I need it to look for my clients who use custom styles so they can select items easier. Is this possible anymore?
- The topic ‘Custom Style names assigned in functions.php file are gone’ is closed to new replies.