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
评论列表(0条)