Custom Dashboard Styles

We had a network activated plugin throwing a notification across all our site dashboards. We did not wish for this to happen any longer. So this was added to a network activated plugin.

The first part enqueues a css script for the dashboard.

function alt_dash_admin_style() {
  wp_enqueue_style('alt-dash-admin-styles', plugin_dir_url( __FILE__ ) .'/css/alt-dash.css');
}
add_action('admin_enqueue_scripts', 'alt_dash_admin_style');

The CSS makes the message hidden.

[data-id="connect_account"] {
  /* should hide the fail 2 ban nag */
  visibility: hidden;
}

The css targets a particular element that’s something like what you see below. I wondered if css could target things based on data attribute values and it can.

<div data-id="connect_account" class="foo bar buzz">Words and what not</div>

Comments on this post

No comments.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL