Register some bogus post types with icons.
<?php | |
/** | |
* Plugin Name: Register Some Post Types | |
*/ | |
add_action( 'init', 'my_register_post_types' ); | |
function my_register_post_types() { | |
register_post_type( 'cpt-1', array( | |
'label' => 'Image', | |
'public' => true, | |
'show_in_menu' => true, | |
'menu_icon' => 'http://0.gravatar.com/avatar/8585b20b69e8ff4b0ba737accfdbb31b?s=50', | |
) ); | |
register_post_type( 'cpt-2', array( | |
'label' => 'Sprite', | |
'public' => true, | |
'show_in_menu' => true, | |
'menu_icon' => array( | |
'image_url' => admin_url( 'images/menu.png?ver=' . time() ), | |
'background_position' => '-359px -33px', | |
'background_position_hover' => '-359px, -1px', | |
), | |
) ); | |
register_post_type( 'cpt-3', array( | |
'label' => 'Sprite 2x', | |
'public' => true, | |
'show_in_menu' => true, | |
'menu_icon' => array( | |
'regular' => array( | |
'image_url' => admin_url( 'images/menu.png?ver=' . time() ), | |
'background_position' => '-359px, -33px', | |
'background_position_hover' => '-359px -1px', | |
), | |
'2x' => array( | |
'image_url' => admin_url( 'images/menu-2x.png?ver=' . time() ), | |
'background_size' => '390 64', | |
), | |
), | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment