javascript - Wordpress Gutenberg Ajax request

I'm new to react and gutenberg so kind of lost a bit.I am trying to get an array of posts from a custom post type

I'm new to react and gutenberg so kind of lost a bit. I am trying to get an array of posts from a custom post type. Then loop through those posts and register a block for each one. I can everything else, just having trouble with getting the posts.

Here's my js file.

( function( blocks, element, editor, components, data ) {
    var el = element.createElement;
    var InspectorControls = wp.editor.InspectorControls;
    var PanelBody = wpponents.PanelBody;

    var CustomPostsTypePosts = //this is where I want to get the posts;

    CustomPostTypePosts.forEach(function(element) {
        //now I will register a block for each post here
        blocks.registerBlockType();
    });


}(
    window.wp.blocks,
    window.wp.element,
    window.wp.data,
    window.wp.editor,
    window.wpponents

) );

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745380549a4625202.html

相关推荐

  • javascript - Wordpress Gutenberg Ajax request

    I'm new to react and gutenberg so kind of lost a bit.I am trying to get an array of posts from a custom post type

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信