AI Verified

Name

Add icons to the custom post types in the At a Glance Dashboard widget

About

This snippet adds custom icons to your custom post type counters in the At a Glance widgets on your WordPress Dashboard. I have a snippet in my Codevault on how to add CPTs to this widget too.

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

• "Only run in administration area" in the snippet settings. • You will need to replace "custom-post-type-x" with the slug of your custom post type. • You can change the icon for each custom post type by changing the value after "content". This usually looks something like "\f123". You can find a full list of the available WordPress Dashicons here: https://developer.wordpress.org/resource/dashicons.

Codevault

Jamie

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

Website/ Profile URL:

https://www.jdab.co.uk

History

Last modified:

15/11/2023

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Add icons to the custom post types in the At a Glance Dashboard widget

 
                    
1// Add CSS to Admin head
2function cpticons_admin_head() {
3 ?>
4 <style type="text/css" media="screen">
5 #dashboard_right_now .custom_post_type_one-count:before {
6 content: "\f145";
7 }
8 #dashboard_right_now .custom_post_type_two-count:before {
9 content: "\f18f";
10 }
11 #dashboard_right_now .custom_post_type_three-count:before {
12 content: "\f122";
13 }
14 #dashboard_right_now .custom_post_type_four-count:before {
15 content: "\f307";
16 }
17 </style>
18 <?php
19}
20add_filter( 'admin_head', 'cpticons_admin_head' );

0

Related Snippets

Please see some snippets below related to this snippet..

WordPress Admin

AI Verified

0

Empty WP Trash in 5 days

Added: 1 year ago

Last Updated: 1 year ago

Set the number of days to purge items marked as trash in the database. This will happen every 5 days. You can change the 5 to any number such as 7 days for weekly and 30 days for monthly.

WordPress Admin

Pro Verified

0

Hide Wordpress Dashboard Items based on User Role

Added: 9 months ago

Last Updated: 9 months ago

An expansion of a previous code where you can hide items from the WP Sidebar based on the User Role.

WordPress Admin

AI Verified

0

Contact Form 7 Redirect Script

Added: 1 year ago

Last Updated: 1 year ago

Contact Form 7 Redirect after submission Script

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WordPress Admin

AI Verified

1

Add custom post types to the At a Glance Dashboard widget

Added: 3 months ago

Last Updated: 2 months ago

This snippet adds your custom post types to the "At a Glance" widget on your WordPress Dashboard. By default, only Posts and Pages display, but this snippet will allow you to pull in counters for all...

WordPress Admin

AI Verified

0

Add icons to the custom post types in the At a Glance Dashboard widget

Added: 3 months ago

Last Updated: 3 months ago

This snippet adds custom icons to your custom post type counters in the At a Glance widgets on your WordPress Dashboard. I have a snippet in my Codevault on how to add CPTs to this widget too.

Divi Builder

AI Verified

0

Enable the Dynamic Content option in the Divi Number Counter module

Added: 3 months ago

Last Updated: 3 months ago

This snippet enables Dynamic Content in the number field of Divi's Number Counter module. This would then allow you to control the content through a plugin such as ACF rather than the Divi Builder.