Reputation: 4956
I am using the custom post type ui and advance custom field plugins to crate custom post type and fields.
I created the custom post type and also the fields. Then I did use the add_theme_support( 'post-thumbnails' );
in my functions.php file but the set featured image option is not appearing in my custom post type option.
For clarity I have attached some images here:
As you can see the below mentioned image shows a custom post type but it is not allowing me to set any featured image.(no "set featured image" option on right side)
This image shows the custom fields that are created for the custom post type. Just to check that everything is correct.
I have set the rules to show the field group if post type is equal to portfolio.And I have also set the style to standard WP metabox.
The third image here is to make clear that I have enabled the featured image option for the custom post type.
So, can anyone please help why am I not getting the featured image option for my custom post types here?
Am I missing something?
Below is my functions.php file where I am adding theme support for post-thumbanils. Do I need to register post-thumbanails for my custom post types?
functions.php:
<?php
add_theme_support('menus');
add_theme_support( 'post-thumbnails');
function register_theme_menus(){
register_nav_menus(
array('primary-menu' => 'Primary Menu')
);
}
add_action('init','register_theme_menus');
?>
Upvotes: 0
Views: 620
Reputation: 2942
add thumbnail in array in register_post_type()
function
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
$args = array(.......,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )
);
register_post_type( 'YOUR_POST_TYPE', $args );
Upvotes: 1