Comments (6)
Do wp acorn vendor:publish
without specifying the provider and choose from the list (working on a fix in Acorn)
from poet.
I have to be honest, if it wasn't for this issue thread I would not have been able to get it running.
But, now it worked for me.
I assume it's because I'm new to everything. I have no experience in WP Theme development and I have started with sage10. So, I have also never created my own Gutenberg block before.
The major issues that needed trial and error and closer reading for me were:
- I have to register via the new block via
editor.js
- got to know theregisterBlockType
this way - the namespaces have to match everywhere (
sage/<myblock>
by default) so that theresources/views/blocks/<myblock>.balde.php
file is loaded – learned that it works as I expect it when I do not provide asave
property during block registration- Disclaimer not tried to get InnerBlocks working yet
One question that is still open for me: Can I set the block-category for a block in the poet.php
or does it need to be via registerBlockType
in the JS files?
-- EDIT --
I forgot to thank you @Log1x for this package. It was still fun to figure the things out from above.
-- EDIT --
-- EDIT 2--
I think I have finally understood why the confusion.
This package is to get a server side configured more easily mostly for existing blocks – amongst all the other things like taxonomy etc.
It does not to be in the scope of the package to create custom blocks.
I think the confusion started since I landed on this repo from a link in another discussion that was about custom block creation.
Now, I understand how to use this package.
-- EDIT 2--
from poet.
did you register the block in javascript?
e.g.
import { __ } from '@wordpress/i18n'
import { registerBlockType } from '@wordpress/blocks'
import { InnerBlocks } from '@wordpress/block-editor'
/** components */
import edit from './edit.js'
registerBlockType(`block/accordion`, {
title: __(`Accordion`, `sage`),
category: `formatting`,
icon: `format-image`,
attributes: {
accordions: {
type: 'array',
default: [{ label: 'New accordion' }],
},
},
edit,
save: () => <InnerBlocks.Content />,
})
from poet.
did you register the block in javascript?
Ah no, I did not. I naively assumed the plugin handled the block registration, much like the acf approach in Log1x/acf-composer
since I read nothing about it in the readme. I've worked with wp-blocks boilerplates before. They watch and build the .js files and the build files are being served.
If I place your snippit simply in a /App/blocks/accordion/block.js
file (along with a editor.js file) and enqeue them I get an Es6 import error. So I guess I miss extra steps and knowledge :)
How would I handle this?
The wp acorn vendor:publish
did the trick, thanks. I've had this with several composer plugins. I can now use this elsewhere as well. Thanks Brandon.
from poet.
Literately seconds later I figured I could place this in the assets folder... Like /resources/assets/scripts/blocks/accordion/block.js
And import them in the editor.js
. No luck yet, but now, it builds : )
-- edit --
Even though I typed editor here, I actually placed it in the app.js. Now it all shows up in the wp - editor . Party-party!
May I suggest to make a note of this in the readme? The part of needing to add the registerBlockType()
to the assets folder and a reference to the documentation.
Or better yet, a code example from, like you just shared.
-- end edit --
from poet.
I have "Unable to locate publishable resources" too.
from poet.
Related Issues (20)
- Gutenberg Block Category
- I'm drafting something up
- WordPress 5.8 block_categories deprecated HOT 1
- Shouldn't add_filter be add_action? HOT 4
- Renaming default 'post' post_type HOT 3
- The custom block is not working HOT 4
- compatibility with acorn and sage 10 beta 3 HOT 1
- Unable to modify default 'category' taxonomy HOT 1
- $content is empty when the only content is an img HOT 2
- Unable to publish the config/poet.php HOT 1
- Registered block not available in block library HOT 5
- Translating post type label and slug HOT 18
- Manually publish HOT 2
- Query vars not working aside post_types archives pages HOT 1
- Register fields with WP GraphQL HOT 4
- Check pattern content before return pattern blade view
- Error including functions in config file HOT 2
- Can not register post type again when move code to server or pull code to another devices HOT 7
- Callback for custom fields in CPT HOT 2
- taxonomies defined by poet aren't available to acf-composer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poet.