Add css code in admin_enqueue_scripts

If you’re using the admin_enqueue_scripts hook, use wp_enqueue_script() to enqueue a CSS file with the styles you want to apply. If you want to output a <style></style> element use the admin_head hook to output it between the <head></head> tags: function custom_css_stuff() { ?> <style type=”text/css”> body { color: red; } </style> <?php } add_action( ‘admin_head’, … Read more

Different css rules for TinyMCE and Gutenberg while using add_editor_style()

SHORT VERSION Using css it’s possible to use of the :not() selector to exclude Tinymce instances, e.g. body:not(.mce-content-body) {…} LONG VERSION Let’s assume we have declared theme support for editor styles and included an editor stylesheet somewhere in our theme (e.g functions.php) like this: add_theme_support( ‘editor-styles’ ); add_editor_style( ‘something/something/css/editor.css’ ); For the sake of this … Read more

editor-style.css Functionality

The correct way to enqueue an editor stylesheet is as follows: add_action( ‘after_setup_theme’, ‘generate_child_setup’ ); function generate_child_setup() { add_editor_style( ‘path/to/editor-style.css’ ); } I pulled that snippet from here: https://generatepress.com/forums/topic/how-to-call-editor-style-css-from-child-theme/#post-149083 I guess the intuitive approach for most would be to enqueue it in the admin but that wouldn’t apply it correctly. I believe add_editor_style() ensures it’s … Read more

Set admin body to ltr on a rtl installation

Important: You shouldn’t modify core files, because you might loose all your edits in the next core upgrade. You should instead enqueue your own stylesheet with your custom CSS modifications through the admin_enqueue_scripts hook or use a hook like admin_head to implement your customization. Here’s an example: /** * Force #wpbody to the ‘ltr’ direction: … Read more

enqueue admin styling and scripts only on plugin page

You can use $screen = get_current_screen(); functions to get the current screen and add warp your enqueue method with the if conditions to check the screen. https://codex.wordpress.org/Function_Reference/get_current_screen public function enqueue_scripts() { $screen = get_current_screen(); // Check screen base and page if ( ‘options-general’ === $screen->base && $_GET[‘page’] ===’uwc’ ) { wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) … Read more

How to add a class to the element in a custom Gutenberg block

That documentation is for the base ButtonBlockAppender component in the @wordpress/block-editor package, and that component is exported with the name ButtonBlockerAppender (note the “Blocker” vs “Block”). But your code is actually using InnerBlocks.ButtonBlockAppender which is an enhanced version of that base ButtonBlockAppender component, and as of writing, that enhanced version does not include the className … Read more

Deregister CSS style link ‘open-sans-css’

WP Core actually uses Open Sans font; it’s not a plugin. there is a plugin that removes it, but you can probably simply dequeue or deregister it. adding this to functions.php should work; if you want it removed from the backend as well, hook into the admin_print_styles action. function dequeue_opensans_css() { wp_dequeue_style( ‘open-sans’ ); } … Read more

Changing Gutenberg / WP block editor width only on pages, not posts or other taxonomies

Because the WordPress hook add_theme_support( ‘editor-styles’ ); adds the css in the style-editor.css and appends the class .editor-styles-wrapper before my .wp-block, the usage of the body classes for page vs. post styles fails. Instead I use the answer from here, from David Walsh, to add the styles independently to the wp admin area: // Update … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)