Kiran Dash
Kiran Dash

Reputation: 4956

set featured image option not appearing after adding theme support for custom post

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)

enter image description here

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.

enter image description here

The third image here is to make clear that I have enabled the featured image option for the custom post type.

enter image description here

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

Answers (1)

vrajesh
vrajesh

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

Related Questions