Custom Dashboard Styles

frisbee surrounded by bright fall leaves.

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>