• I’v created a custom post type with Custom Post Type UI and installed your plugin but the post types don’t show up.

    Checked all the settings. I’m using Atomic Blocks theme.

    Any suggestions?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ronald Huereca

    (@ronalfy)

    Is show_in_rest and has_archive set to true?

    Thread Starter sjvlnl

    (@sjvlnl)

    Yes, I noticed in Custom Post Type UI that I have two other fields which are left empty:

    REST API base slug

    and

    REST API controller class

    Is that correct?

    Plugin Author Ronald Huereca

    (@ronalfy)

    @sjvlnl

    Can you please post a screenshot of your Custom Post Type UI settings or the code it generates so I can duplicate it.

    Thread Starter sjvlnl

    (@sjvlnl)

    Here’s the code:

    function cptui_register_my_cpts() {
    
    	/**
    	 * Post Type: Kennisbank-items.
    	 */
    
    	$labels = [
    		"name" => __( "Kennisbank-items", "atomic-blocks" ),
    		"singular_name" => __( "Kennisbank-item", "atomic-blocks" ),
    		"menu_name" => __( "Kennisbank", "atomic-blocks" ),
    		"all_items" => __( "Alle Kennisbank-items", "atomic-blocks" ),
    		"add_new" => __( "Nieuw Kennisbank-item toevoegen", "atomic-blocks" ),
    		"add_new_item" => __( "Nieuw Kennisbank-item toevoegen", "atomic-blocks" ),
    		"edit_item" => __( "Bewerk Kennisbank-item", "atomic-blocks" ),
    		"new_item" => __( "Nieuw Kennisbank-item", "atomic-blocks" ),
    		"view_item" => __( "Bekijk Kennisbank-item", "atomic-blocks" ),
    		"view_items" => __( "Bekijk Kennisbank-items", "atomic-blocks" ),
    		"search_items" => __( "Zoek Kennisbank-items", "atomic-blocks" ),
    		"not_found" => __( "No Kennisbank-items found", "atomic-blocks" ),
    		"not_found_in_trash" => __( "No Kennisbank-items found in trash", "atomic-blocks" ),
    		"parent" => __( "Hoofd Kennisbank-item:", "atomic-blocks" ),
    		"featured_image" => __( "Featured image for this Kennisbank-item", "atomic-blocks" ),
    		"set_featured_image" => __( "Set featured image for this Kennisbank-item", "atomic-blocks" ),
    		"remove_featured_image" => __( "Remove featured image for this Kennisbank-item", "atomic-blocks" ),
    		"use_featured_image" => __( "Use as featured image for this Kennisbank-item", "atomic-blocks" ),
    		"archives" => __( "Kennisbank-item archives", "atomic-blocks" ),
    		"insert_into_item" => __( "Insert into Kennisbank-item", "atomic-blocks" ),
    		"uploaded_to_this_item" => __( "Upload to this Kennisbank-item", "atomic-blocks" ),
    		"filter_items_list" => __( "Filter Kennisbank-items list", "atomic-blocks" ),
    		"items_list_navigation" => __( "Kennisbank-items list navigation", "atomic-blocks" ),
    		"items_list" => __( "Kennisbank-items list", "atomic-blocks" ),
    		"attributes" => __( "Kennisbank-items attributes", "atomic-blocks" ),
    		"name_admin_bar" => __( "Kennisbank-item", "atomic-blocks" ),
    		"item_published" => __( "Kennisbank-item published", "atomic-blocks" ),
    		"item_published_privately" => __( "Kennisbank-item published privately.", "atomic-blocks" ),
    		"item_reverted_to_draft" => __( "Kennisbank-item reverted to draft.", "atomic-blocks" ),
    		"item_scheduled" => __( "Kennisbank-item scheduled", "atomic-blocks" ),
    		"item_updated" => __( "Kennisbank-item updated.", "atomic-blocks" ),
    		"parent_item_colon" => __( "Hoofd Kennisbank-item:", "atomic-blocks" ),
    	];
    
    	$args = [
    		"label" => __( "Kennisbank-items", "atomic-blocks" ),
    		"labels" => $labels,
    		"description" => "Voor het tonen van de Slimme Verlichting kennisbank op Slimmeverlichting.nu",
    		"public" => true,
    		"publicly_queryable" => true,
    		"show_ui" => true,
    		"show_in_rest" => true,
    		"rest_base" => "",
    		"rest_controller_class" => "WP_REST_Posts_Controller",
    		"has_archive" => "kennisbank-archief",
    		"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" => "kennisbank", "with_front" => true ],
    		"query_var" => true,
    		"menu_icon" => "dashicons-welcome-learn-more",
    		"supports" => [ "title", "editor", "thumbnail", "excerpt", "trackbacks", "custom-fields", "revisions", "author", "page-attributes", "post-formats" ],
    	];
    
    	register_post_type( "kennisbank", $args );
    }
    
    add_action( 'init', 'cptui_register_my_cpts' );
    • This reply was modified 4 years, 10 months ago by sjvlnl.
    Plugin Author Ronald Huereca

    (@ronalfy)

    So weird. I have installed/activated the theme, used the exact code you posted, and am seeing the post type.

    Thread Starter sjvlnl

    (@sjvlnl)

    Thank you for testing the code.

    In my website the Custom Post type is in fact created correctly because I’m also testing the Post Grid-plugin and the Display Post-plugin and they display my Custom Post type posts correctly.

    When I use Gutenberg Blocks to display a post grid of my custom post type I don’t see it, so there must be something wrong.

    What else can I do to make the Gutenberg Blocks work?

    Plugin Author Ronald Huereca

    (@ronalfy)

    @sjvlnl do you by any chance have a plugin that disables the REST API for certain endpoints?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Post type not shown’ is closed to new replies.