• hazephase

    (@hazephase)


    // Add new post type for Book Lessons
    add_action('init', 'Book_Lessons_init');
    function Book_Lessons_init()
    {
    	$book_labels = array(
    		'name' => _x('Book Lessons', 'post type general name'),
    		'singular_name' => _x('Book Lessons', 'post type singular name'),
    		'all_items' => __('All Book Lessons'),
    		'add_new' => _x('Add new Book Lessons', 'Book Lessons'),
    		'add_new_item' => __('Add new Book Lessons'),
    		'edit_item' => __('Edit Book Lessons'),
    		'new_item' => __('New Book Lessons'),
    		'view_item' => __('View Book Lessons'),
    		'search_items' => __('Search in Book Lessons'),
    		'not_found' =>  __('No Book Lessons found'),
    		'not_found_in_trash' => __('No Book Lessons found in trash'),
    		'parent_item_colon' => '',
    
    	);
    	$args = array(
    		'labels' => $book_labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => true,
    		'capability_type' => 'post',
    		'hierarchical' => false,
    		'menu_position' => 5,
    		'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields'),
    		'has_archive' => 'Book'
    	);
    	register_post_type('book',$args);
    }

    This is the custom post type I am trying to create, can you tell me how do I change the default icon in the admin panel ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • C W (VYSO)

    (@cyril-washbrook)

    Set the menu_icon key. If you want to use the in-built icon font, you can find the available icons on this page. The value will be the name of the relevant icon (e.g. dashicons-format-aside).

    Venugopal

    (@mynamevenu24)

    Add in $args array

    'menu_icon' => 'dashicons-cart',

    or
    Custom image

    <code>'menu_icon'  => 'https://www.example.com/wp-content/uploads/2016/02/your-cpt-icon.png',</code>

    Thread Starter hazephase

    (@hazephase)

    thanks guy will try this out

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change the default icon of Custom Post Type’ is closed to new replies.