Support » Plugin: Custom Fields for Gutenberg » Custom Post Type

  • Resolved Janet A

    (@janet_a)


    Hello,

    My custom post type does not display in the post types list in settings.
    Your assistance is greatly appreciated!

    Thank you

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hello, glad to help. This plugin only adds a custom fields meta box. It doesn’t really have anything to do with post types and post-type lists. Unless you are referring to the CF meta box not displayed on custom post types?

    Yes, the CF meta box is not displaying on my custom post page. It displayed normally pre-Guternberg.

    In your plugin settings for Post types: there are checkboxes for: Posts, Pages, and in my case a plugin post type ‘modernteammembers’ is also an option, but my custom post type does not appear as an option.

    Thanks for your time!

    Plugin Author Jeff Starr

    (@specialk)

    That is very helpful information, thank you. The plugin looks for specific things in order for the “Post Type” enable option to display in the settings. So it sounds like the post type you are working with is not configured to support Gutenberg or similar. If you can get the code used to register your custom post type, it would be possible to investigate further and hopefully resolve the issue one way or another. For reference, the function used to register a custom post type is register_post_type().

    Thanks for your prompt response!

    Here’s my code:

    function my_custom_posttypes() {
    // Studies Post Type
    $labels = array(
    ‘name’ => ‘Studies’,
    ‘singular_name’ => ‘Study’,
    ‘menu_name’ => ‘Studies’,
    ‘name_admin_bar’ => ‘Study’,
    ‘add_new’ => ‘Add New’,
    ‘add_new_item’ => ‘Add New Study’,
    ‘new_item’ => ‘New Study’,
    ‘edit_item’ => ‘Edit Study’,
    ‘view_item’ => ‘View Study’,
    ‘all_items’ => ‘All Studies’,
    ‘search_items’ => ‘Search Studies’,
    ‘parent_item_colon’ => ‘Parent Studies:’,
    ‘not_found’ => ‘No Studies found.’,
    ‘not_found_in_trash’ => ‘No Studies found in Trash.’,
    );

    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘show_in_menu’ => true,
    ‘menu_icon’ => ‘dashicons-id-alt’,
    ‘query_var’ => true,
    ‘rewrite’ => array( ‘slug’ => ‘studies’ ),
    ‘capability_type’ => ‘post’,
    ‘has_archive’ => true,
    ‘hierarchical’ => false,
    ‘menu_position’ => 3,
    ‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’),
    ‘taxonomies’ => array( ‘category’ ),
    ‘show_in_rest’ => true
    );
    register_post_type( ‘studies’, $args );
    }
    add_action( ‘init’, ‘my_custom_posttypes’ );

    // Flush rewrite rules to add “Studies” as a permalink slug
    function my_rewrite_flush() {
    my_custom_posttypes();
    flush_rewrite_rules();
    }
    register_activation_hook( __FILE__, ‘my_rewrite_flush’ );

    Ah! I think I got it. I added supports ‘custom-fields’ and I now see the meta!

    I don’t see my field group, however.

    Plugin Author Jeff Starr

    (@specialk)

    Thank you.

    It looks like custom-fields needs added to the supports parameter, like so:

    'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),

    Otherwise, custom fields meta is not enabled for the post type.

    Plugin Author Jeff Starr

    (@specialk)

    What is the the “field group”?

    I am using Advanced Custom Fields, and like custom meta, the fields would display for data entry in the editor. Now with Gutenberg, these ‘field groups’ (A bunch of custom fields) do not display. I was hoping your plugin would be a quick remedy but I see I have more work to do in finding a solution.

    Thanks for the help anyway!

    Plugin Author Jeff Starr

    (@specialk)

    Understood and no problem, let me know if I may be of service, glad to help however possible.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Custom Post Type’ is closed to new replies.