-
-
Save mannieschumpert/f6e19b7935c24e213ceb to your computer and use it in GitHub Desktop.
Using WordPress 3.8 Icons for your Custom Post Types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_menu_icons_styles(){ | |
?> | |
<style> | |
#adminmenu .menu-icon-events div.wp-menu-image:before { | |
content: '\f145'; | |
} | |
</style> | |
<?php | |
} | |
add_action( 'admin_head', 'add_menu_icons_styles' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#adminmenu .menu-icon-events div.wp-menu-image:before { | |
content: '\f145'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function create_events_cpt() { | |
register_post_type( 'events', | |
array( | |
'public' => true, | |
'has_archive' => true, | |
'menu_position' => 5, // places menu item directly below Posts | |
'menu_icon' => '', | |
'labels' => array( | |
'name' => __( 'Events' ), | |
'singular_name' => __( 'Event' ), | |
'add_new' => __( 'Add New' ), | |
'add_new_item' => __( 'Add New Event' ), | |
'edit' => __( 'Edit' ), | |
'edit_item' => __( 'Edit Event' ), | |
'new_item' => __( 'New Event' ), | |
'view' => __( 'View Event' ), | |
'view_item' => __( 'View Event' ), | |
'search_items' => __( 'Search Events' ), | |
'not_found' => __( 'No Events found' ), | |
'not_found_in_trash' => __( 'No Events found in Trash' ), | |
'parent' => __( 'Parent Event' ), | |
), | |
) | |
); | |
} | |
add_action( 'init', 'create_events_cpt' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment