• Resolved Seath

    (@seath)


    So I am trying you plugin and I have problem.

    I have set up my custom post type, and I have set up my AFC fields. The problem is that the Featured Image dos not showing up in edit screen of the post.

    function cptui_register_my_cpts_recipe() {
    
    	/**
    	 * Post Type: Recipe.
    	 */
    
    	$labels = [
    		"name" => __( "Recipe", "nownowlife" ),
    		"singular_name" => __( "Recipe", "nownowlife" ),
    		"menu_name" => __( "My Recipe", "nownowlife" ),
    		"all_items" => __( "All Recipe", "nownowlife" ),
    		"add_new" => __( "Add new", "nownowlife" ),
    		"add_new_item" => __( "Add new Recipe", "nownowlife" ),
    		"edit_item" => __( "Edit Recipe", "nownowlife" ),
    		"new_item" => __( "New Recipe", "nownowlife" ),
    		"view_item" => __( "View Recipe", "nownowlife" ),
    		"view_items" => __( "View Recipe", "nownowlife" ),
    		"search_items" => __( "Search Recipe", "nownowlife" ),
    		"not_found" => __( "No Recipe found", "nownowlife" ),
    		"not_found_in_trash" => __( "No Recipe found in trash", "nownowlife" ),
    		"parent" => __( "Parent Recipe:", "nownowlife" ),
    		"featured_image" => __( "Featured image for this Recipe", "nownowlife" ),
    		"set_featured_image" => __( "Set featured image for this Recipe", "nownowlife" ),
    		"remove_featured_image" => __( "Remove featured image for this Recipe", "nownowlife" ),
    		"use_featured_image" => __( "Use as featured image for this Recipe", "nownowlife" ),
    		"archives" => __( "Recipe archives", "nownowlife" ),
    		"insert_into_item" => __( "Insert into Recipe", "nownowlife" ),
    		"uploaded_to_this_item" => __( "Upload to this Recipe", "nownowlife" ),
    		"filter_items_list" => __( "Filter Recipe list", "nownowlife" ),
    		"items_list_navigation" => __( "Recipe list navigation", "nownowlife" ),
    		"items_list" => __( "Recipe list", "nownowlife" ),
    		"attributes" => __( "Recipe attributes", "nownowlife" ),
    		"name_admin_bar" => __( "Recipe", "nownowlife" ),
    		"item_published" => __( "Recipe published", "nownowlife" ),
    		"item_published_privately" => __( "Recipe published privately.", "nownowlife" ),
    		"item_reverted_to_draft" => __( "Recipe reverted to draft.", "nownowlife" ),
    		"item_scheduled" => __( "Recipe scheduled", "nownowlife" ),
    		"item_updated" => __( "Recipe updated.", "nownowlife" ),
    		"parent_item_colon" => __( "Parent Recipe:", "nownowlife" ),
    	];
    
    	$args = [
    		"label" => __( "Recipe", "nownowlife" ),
    		"labels" => $labels,
    		"description" => "",
    		"public" => true,
    		"publicly_queryable" => true,
    		"show_ui" => true,
    		"show_in_rest" => true,
    		"rest_base" => "recipes",
    		"rest_controller_class" => "WP_REST_Posts_Controller",
    		"has_archive" => false,
    		"show_in_menu" => true,
    		"show_in_nav_menus" => true,
    		"delete_with_user" => false,
    		"exclude_from_search" => false,
    		"capability_type" => "post",
    		"map_meta_cap" => true,
    		"hierarchical" => false,
    		"rewrite" => [ "slug" => "recipes", "with_front" => true ],
    		"query_var" => "recipes",
    		"menu_position" => 5,
    		"menu_icon" => "dashicons-carrot",
    		"supports" => [ "title", "thumbnail", "custom-fields", "comments" ],
    		"taxonomies" => [ "course", "cuisine" ],
    		"show_in_graphql" => false,
    	];
    
    	register_post_type( "recipe", $args );
    }
    
    add_action( 'init', 'cptui_register_my_cpts_recipe' );

    can you please help..

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hi,

    Best guess I have is that perhaps in the screen options tab in the upper right corner, you don’t have “Featured image for this Recipe” checked. Beyond that, I was able to copy/paste your snippet into my local dev install and have no issue seeing or setting a featured image for a post in this Recipe post type.

    Hopefully that screen options bit is the missing detail.

    Thread Starter Seath

    (@seath)

    It’s not showing up there either.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Since you’re using the code version, by chance do you also have this same Recipe post type still saved in your CPTUI settings, and by chance does it not have “thumbnail” checked?

    Post types are at times regrettably a global array, and it’s possible to override/register a post type of the same slug, with different settings. Whichever version gets encountered last is the one ultimately used.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Featured Image’ is closed to new replies.