How to add post formats to custom post types
-
I have WP4.1 with my own theme.
I registered custom post type ‘products’ and tried to add some post formats to it.
At first, I wrote this code in functions.php:
add_action( 'after_setup_theme', 'my_theme_setup' ); function my_theme_setup(){ add_theme_support( 'post-formats', array( 'aside', 'image', 'quote' ) ); add_post_type_support( 'products', 'post-formats', array( 'aside', 'image', 'quote' ) ); }
It worked okay and added metabox in admin page allowing to select post format (when adding/editing the posts/products)
However, I didn’t want to add post format support for standard posts, only for products.
So I removed add_theme_support() call from the above code.
After that I tried to add/edit the product, but metabox with format selection was gone, and I could not assign the format to it.
I’d like to know how to resolve this situation.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to add post formats to custom post types’ is closed to new replies.