1

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 ...

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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.