How to add gallery support to a custom post type?

I've created a custom post type.

add_action( 'init', 'my_custom_post_type' );
function my_custom_post_type() {
  register_post_type( 'my_custom_post_type',
    array(
      'labels' = array(
        'name' = __( 'custom Posts' ),
        'singular_name' = __( 'custom Post' )
      ),
        'public' = true,
        'has_archive' = true,
        'capability_type' = array("custom Post", "custom Posts"),
        'map_meta_cap' = true,
        'supports' = array( 'title', 'editor', 'author', 'thumbnail', 'comments' )
    )
  );
}

If I add any images on the editor it displays as it is on the front end. but If add any gallery it displays as some thing like this: [gallery link="file" ids="581,580,575"]

what I have to do to show the gallery for this custom post type?

Topic post-type-support gallery custom-post-types Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.