Registering different Post Formats for Blog Post and CPT

I’m using following code to register post formats for my blog posts …

add_theme_support( 'post-formats', array( 'gallery', 'video', 'audio' ) );

Now, i want to add post formats support for my CPT ‘Portfolio’ too, but using different set of post formats. Using this code will add post format support for my CPT …

Read More
add_post_type_support( 'portfolio', 'post-formats' );

But i only want to register gallery and video post format for portfolio CPT. Using the code below does’nt work …

add_post_type_support( 'portfolio', 'post-formats', array( 'gallery', 'video' ) );

What code should i use?

Related posts

1 comment

  1. I found an alternative approach.

    There is a unique class in body tag for each post type. e.g for portfolio post type i can use the CSS code something like mentioned below to hide the extra option.

    .post-type-portfolio #post-format-audio, /* for radio button itself */
    .post-type-portfolio .post-format-audio /* for option label */
    {
        display: none;
    }
    

    Hope it helps anybody else.

Comments are closed.