Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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.
    #615594

    I was _just_ looking for this, and this was the only Google result, just nine hours old. :)

    #616115

    Hi,

    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,
    Rikard

    #616152

    It 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.

    #617169

    Hi,

    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,
    Rikard

    #617256

    As requested

    #619292

    Any news on this one?

    #621171

    Hi!

    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,
    Ismael

    #621182

    Hi!

    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

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.