Skip to content

Instantly share code, notes, and snippets.

@mannieschumpert
Last active December 30, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mannieschumpert/f6e19b7935c24e213ceb to your computer and use it in GitHub Desktop.
Save mannieschumpert/f6e19b7935c24e213ceb to your computer and use it in GitHub Desktop.
Using WordPress 3.8 Icons for your Custom Post Types
<?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' );
#adminmenu .menu-icon-events div.wp-menu-image:before {
content: '\f145';
}
<?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