Closed bobbingwide closed 4 years ago
Since there are so many blocks delivered by multiple plugins we need to make it easier to list them.
block_keyword
taxonomy should also be a field. Block categories
taxonomy to store the Block's Category. Note: Currently only one value is supported by the editor.block_categories
taxonomy should also be a field. Auto population
Add another batch routine to set Keywords for each block.
Stored in taxonomy called block_keyword
.
It should also set the block Category, in block_category
.
The routine can also attempt to update the Yoast SEO stuff
Use the first paragraph block for the Yoast SEO Description (yoast_wpseo_metadesc).
Set the Yoast Focus Keyphrase ( yoast_wpseo_focuskw) with the Block name followed by ' block'.
Change the Blocklist block to create the commands for both create and update.
The block create routine could be updated later to do all of these.
And/or a filter on the post save could be used to set any missing SEO data.
example.
oikwp oik-create-blocks.php advgb/accordion "Accordion" url=blocks.wp-a2z.org
oikwp oik-update-blocks.php advgb/accordion "accordion,list,faq" agb url=blocks.wp-a2z.org
The keyword category is no longer limited to 3 keywords.
For improved display of the excerpt the more tag should be after the block info tag.
The batch routines served their purpose when creating new blocks but were only able to go so far.
I now want to add some PHP server logic that will generate / update the block definition given the block's registration information, including the icon.
Implement an AJAX request oiksc_create_or_update_block
that will be invoked from the Block List block. The PHP logic will combine the functions developed for the batch routine to create or update the definition for a block. When a new block CPT is being created it will create the correct oik-blocks/blockinfo
block using the icon which is passed as a serialised string.
Most of the block CPT's fields should be correctly populated. It should then be a case of editing the generated content to create the example(s) and screenshot and adding a link to documentation, if known.
In this first version the AJAX request will be run directly by the user, by right clicking on the link in the block list block and choosing Open link in new window. The output from the AJAX request will be displayed here. This will include a link to edit the post after the create or update has been run.
See https://github.com/bobbingwide/oik-blocks/issues/27 for the changes to the Block list block.
The Block List block will assist in the process, providing buttons to perform the required actions, retrieving the results and displaying them accordingly.
The json_encode() call used to encode attrs needs to include the additional option required in the oik-clone logic. JSON_UNESCAPED_UNICODE... to not encode Unicode characters.
Example being the ellipsis ...
which would be converted to /u2026
.
How do I get a backslash on this iPad keyboard? Ah. Use the fn key: fn+x
The original batch routine have been superceded by the AJAX method. This method sometimes fails when the block icon's SVG is enormous. The workaround is to edit the request to remove the icon and run it again. The issue was released in v1.35.0
There are over 140 blocks in the first 9 plugins that I want to catalogue. See #61. Manually creating them takes too long, even with the template for new posts.
Proposed solution
Create a batch routine to generate the posts, setting post_meta, Yoast SEO stuff and so on. Each block will need editing... but it'll be a kick start.
run from
oik-shortcodes/admin