Sunday, August 21, 2022
HomeWordPress Developmentcss - How can I make the wordpress editor apply the chosen...

css – How can I make the wordpress editor apply the chosen template?


welcome to this discussion board. 🙂

I am not an professional, BUT I did do one thing related by following the directions and tutorials I discovered at these hyperlinks under, hopefully these will assist information you.

In a nutshell, you need to transcend simply enabling the stylesheet within the editor, you might have really add a stylesheet particularly for the editor (editor-styles.css) and declare your kinds in that (being certain to maintain them the identical as your front-facing fashion.css file).

Additionally, method under I put my very own code if it additionally helps to serve for example.

Good luck!!

Tutorials:

https://codex.wordpress.org/TinyMCE_Custom_Styles

https://developer.wordpress.org/reference/capabilities/add_editor_style/

http://wplift.com/how-to-add-custom-styles-to-the-wordpress-visual-post-editor
(observe this final hyperlink is a good tutorial however including the fashion declarations that method didn’t work, I had to make use of the code under)

Extra tutorials:
https://www.wpkube.com/add-dropdown-css-style-selector-visual-editor/

http://www.wpbeginner.com/wp-tutorials/how-to-add-custom-styles-to-wordpress-visual-editor/

My use:

// Unhides the Kinds drop down selector within the 2nd toolbar in Visible Editor
perform bai_tinymce_buttons( $buttons ) {
  //Add fashion selector to the start of the toolbar
  array_unshift( $buttons, 'styleselect' );

  return $buttons;
 }
add_filter( 'mce_buttons_2', 'bai_tinymce_buttons' );

// Provides some kinds to the visible editor codecs (kinds) dropdown, kinds are in editor-style.css
perform bai_mce_before_init_insert_formats( $init_array ) {
// Outline the style_formats array
$style_formats = array(
    // Every array baby is a format with it is personal settings
    array(
        'title' => '.pull-right',
        'block' => 'blockquote',
        'courses' => 'pull-right',
        'wrapper' => true,
    ),
    array(
        'title' => '.suggestions',
        'block' => 'blockquote',
        'courses' => 'suggestions',
        'wrapper' => true,
    ),
    array(
        'title' => '.nutshell',
        'block' => 'div',
        'courses' => 'nutshell',
        'wrapper' => true,
    ),
);
// Insert the array, JSON ENCODED, into 'style_formats'
$init_array['style_formats'] = json_encode( $style_formats );
return $init_array;
}
add_filter( 'tiny_mce_before_init', 'bai_mce_before_init_insert_formats' );

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments