• Hello!

    I am currently trying to make a plugin that adds a custom post type called “Representatives” to WordPress. When creating a new Representative, the user is given a classic editor that asks them to fill out a few metaboxes like “First Name,” “Last Name,” “Position,” and “Short Bio”.

    I am now trying to create a Gutenberg block that will have a <SelectControl> where the user will be able to choose a created Representative from a drop-down list. And display the information in the block.

    I tried to follow this tutorial:

    https://www.ibenic.com/create-gutenberg-block-displaying-post/

    But I cannot get the API to fetch the Representatives. (I also know that some parts of this tutorial is outdated, such as InspectorControls now being in wp.editor).

    Can anyone help me understand how to use <SelectControl> with a custom post type?`

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator t-p

    (@t-p)

    Thread Starter dhregular

    (@dhregular)

    @t-p

    Thanks. If there are any resources on connecting the <SelectControl> with the REST API to grab Custom Post Types, I would greatly appreciate that. I am creating this at the request of a client, and the Representative Post Types are to follow a custom layout they want (and we only need one block; 40 would overwhelm the people I have to train).

    Moderator t-p

    (@t-p)

    (and we only need one block; 40 would overwhelm the people I have to train).

    This plugin seems to have only one block: https://www.ads-software.com/plugins/custom-post-type-widget-blocks/

    The plugin has only 3 blocks: https://www.ads-software.com/plugins/post-type-archive-mapping/

    Thread Starter dhregular

    (@dhregular)

    @t-p

    I appreciate looking for plugins, but my custom post type is a combination of custom metaboxes. I need to be able to display and manipulate those in a very specific way.

    I am basically asking for the documentation on how to create the blocks you are showing me. Let me preface this by saying I know roughly how to make a Gutenberg block, and in my original post I followed a tutorial that was meant to do the very thing I wanted but it did not work (and the author itself even states in the comments that the tutorial needs to be redone).

    With PHP/JSX or with the REST API, how do I fetch my Custom Post Type metabox data to display in a custom metabox created using coding in visual studio code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Creating Gutenberg Block to Display Custom Post’ is closed to new replies.