Articles of admin css

Custom css author role

I need a code snippet to load css (extra style sheet?) when a author is logged in. This is for a custom dashboard and post “page”. The screenshot is what i mean by post page. I want to hide stuf by css for only authors. Things within the red circles are things i want to […]

Margin problem on management menu?

I’m developing a WordPress site ( It’s a multilingual site with around 15 languages at the end. I found this ‘mistake?’ in the Menus area: When I have more languages than they fit in the left column, they start to disappear back the right column. Could you please tell me which one of the ones […]

Media Upload not working after hiding some elements from functions.php

I have put the below code in functions.php. (It’s used to hide some options from client.) But the problem is, after adding these codes, images are not uploading, can’t even even uploaded photos from library or while creating a new post. Someone pls help echo ‘<style> #toplevel_page_wpcf7, #wp-admin-bar-wp-logo, #screen-meta-links, #menu-tools, #wp-admin-bar-wpseo-menu, #footer-upgrade, #toplevel_page_wpfront-user-role-editor-all-roles,#toplevel_page_vc-general, #menu-settings,#toplevel_page_wpseo_dashboard, #toplevel_page_revslider, […]

How to add custom css to login and admin?

I have custom CSS for the login and admin pages. Is it OK to add it as I’ve done below, or is there a better alternative? function custom_admin_css() { wp_enqueue_style( ‘custom_admin_css’, get_template_directory_uri() . ‘/css/admin.css’, array(), filemtime( get_template_directory() . ‘/css/admin.css’ ) ); } add_action( ‘login_enqueue_scripts’, ‘custom_admin_css’, 10 ); add_action( ‘admin_enqueue_scripts’, ‘custom_admin_css’, 10 );

How to reference an existing css content-based icon, within my admin menu hook

Within WordPress 4.6.1, I really like the thumbtack icon that is being used in the admin menus. This is the thumbtack icon (generated in CSS) that I am referring to… I’m currently using the WordPress API to generate my own menu with the following admin menu hook… add_menu_page(‘Cool Plugin Page’, ‘Cool Plugin’, ‘manage_options’, ‘my_main_menu’,’my_main_plugin_page’, plugins_url(‘/images/thumbtack-icon.jpg’,__FILE__)); […]

Enqueue a file that's not js or css

I want to register a new css document that I’m storing inside a PHP file (so that I can create variable css rules). I tried doing this: function tps_admin_scripts() { $plugin_url = plugin_dir_url( __FILE__ ); wp_register_script(‘admin-variable-style’, $plugin_url.’css/style-variable.php’); wp_enqueue_script(‘admin-variable-style’); } add_action(‘admin_enqueue_scripts’, ‘tps_admin_scripts’); And I’ve also tried wp_enqueue_style with no luck. Additionally, I tried require_once (plugin_dir_path(__FILE__).’css/style-variable.php’); But […]

Adding CSS to admin TinyMCE editor for custom button

I have created a plugin that adds a new button to the TinyMCE editor in the admin edit pages/posts area. I am trying to apply a font icon to it as per the the other buttons in WordPress 3.8. I have created a CSS file will the following: .mce_mybutton::before { content: ‘\f459’; } All I […]

Simple/basic use of get_current_screen

I would like to load a stylesheet on only 3 admin pages: post.php?post=7&action=edit post.php?post=10&action=edit post.php?post=18&action=edit I was trying with admin_enqueue_script but it doesn’t seem to be capable of such specificity (see my related wpse post), which led me to get_current_screen. But all the examples and articles I find about get_current_screen refer to using it with […]

Distributing Frontend Assets with Plugins

I’d like to distribute some custom style sheets (.css) and javascript files (.js) with my plugin. Is there a right way to do this in WordPress? I can think of a number of different ways to do this, but I’d prefer to use one that’s WordPress recommended, or a defacto time and true standard. Specifically […]

Apply custom css for user role

How can I apply custom CSS for user role, both for dashboard and frontend? For dashboard I set: if( current_user_can(‘seller’, ‘partner’)) { function admin_style() { wp_enqueue_style(‘admin-styles’, get_template_directory_uri().’/admin.css’); } add_action(‘admin_enqueue_scripts’, ‘admin_style’); } else { } how to modify the code to load also on front? btw, Is if( current_user_can(‘seller’, ‘partner’)) correct for checking is user role […]