-
AuthorPosts
-
April 16, 2016 at 2:36 pm #615459
I have tried to add my own styles to the editor in ALB using code similar to the below, but no matter what I do, it does not seem to work. None of my own styles show up in the dropdown in the editor.
function my_mce_before_init( $init_array ) { $init_array['theme_advanced_styles'] = '.mellemrubrik=Mellemrubrik;.rubrik=Rubrik;.underrubrik=Underrubrik;'; return $init_array; } add_filter( 'tiny_mce_before_init', 'my_mce_before_init' ); add_editor_style('css/jobsamtale-nu.css');
Is it at all possible to add own styles to the editor dropdown and if yes, how should it be done?
- This topic was modified 8 years, 7 months ago by mwestermann.
April 16, 2016 at 11:10 pm #615594I was _just_ looking for this, and this was the only Google result, just nine hours old. :)
April 18, 2016 at 7:25 am #616115Hi,
That looks like a function that should go into your functions.php file, where did you find it and what is it supposed to do?
Thanks,
RikardApril 18, 2016 at 8:26 am #616152It is in functions .php for my child theme and I found it here https://codex.wordpress.org/TinyMCE_Custom_Styles
It is supposed to augment the dropdown of predefined styles in the text editor (which I assume is TinyMCE) and add a corresponding stylesheet so the editor can format appropriately.
April 19, 2016 at 7:39 am #617169Hi,
Ok, could you please provide us with a temporary admin login so that we can take a closer look? You can post the details in the Private Content section of your reply.
Regards,
RikardApril 19, 2016 at 9:58 am #617256As requested
April 21, 2016 at 6:11 pm #619292Any news on this one?
April 25, 2016 at 11:30 am #621171Hi!
I’m sorry but this is not a theme related issue and should be asked somewhere else. If you want to learn more about these advanced styles, please refer to the available resources provided in the documentation: https://codex.wordpress.org/TinyMCE_Custom_Styles#Further_Reading
An alternative is to add custom styles in the Quick CSS field and define your own unique css selector. For example, in the Quick CSS field, add something like this:
.custom-bold-italic { font-style: italic; font-weight: bold; ]
You can then use the custom-bold-italic class attribute in a code or text block to apply the custom css style:
<span class="custom-bold-italic">THIS FONT IS BOLD AND ITALIC</span>
This is not as pretty as the advanced style filter but it works the same
.
Regards,
IsmaelApril 25, 2016 at 11:39 am #621182Hi!
refrain from bumping into your own thread, as it pushes it behind in our queue and marks it as answered and then we can’t provide a faster reply to you.
Does it work when using a default WP theme instead? please let us know about your results.
Regards,
Andy -
AuthorPosts
- You must be logged in to reply to this topic.