Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to extend a WordPress block #283

Closed
bph opened this issue Jul 4, 2024 Discussed in #278 · 10 comments
Closed

How to extend a WordPress block #283

bph opened this issue Jul 4, 2024 Discussed in #278 · 10 comments
Assignees

Comments

@bph
Copy link
Collaborator

bph commented Jul 4, 2024

Discussed in #278

Originally posted by ndiego June 20, 2024
Custom block development is powerful, but often you don’t need to go through the hassle of building a custom block to achieve your goals.

This article will explore 4-5 scenarios where alternatives to custom blocks might be more effective. Often, this will be in the form of block patterns. These non-block alternatives will feature one or more of the following tools:

  • Content-only editing
  • Block naming
  • Block locking
  • allowedBlocks
  • Block bindings
  • Block variations
  • Patterns
  • And more

The goal is to showcase the flexibility and power of the pattern "toolset" and other non-block alternatives in WordPress. Each example will link to further resources, both on the Dev Blog and in the documentation, where readers can learn more about each tool.

Additionally, the Block Editor Handbook will be updated to ensure that each tool covered in this post is thoroughly documented.


Edit: I (@ndiego) have updated the title to reflect the change of direction noted below.

While working on this article, it's become clear that this topic is too big for one article and instead should be two. One dedicated article focused on extending blocks using Block Filters, and another covering the remaining topics in the description.

The first, more technical, article would be "How to extend Core WordPress blocks" and the second would be "Do you really need a custom block? Exploring alternatives to block development in WordPress". The second article would heavily reference the code techniques demonstrated in the first article and focus more on examples.

@ndiego
Copy link
Member

ndiego commented Jul 28, 2024

While working on this article, it's become clear that this topic is too big for one article and instead should be two. One dedicated article focused on extending blocks using Block Filters, and another covering the remaining topics in the description.

The first, more technical, article would be "How to extend Core WordPress blocks" and the second would be "Do you really need a custom block? Exploring alternatives to block development in WordPress". The second article would heavily reference the code techniques demonstrated in the first article and focus more on examples.

What do you think @bph and @juanmaguitar?

@bph
Copy link
Collaborator Author

bph commented Aug 5, 2024

Having two part tutorial, should work, indeed. Go for it.

I could also see a few more granular scenarios where the filter is only applied when a block is an InnerBlock, but not when it's used stand alone.

@juanmaguitar
Copy link
Contributor

Sounds good @ndiego 👍

@ndiego ndiego changed the title Do you really need a custom block? Exploring alternatives to block development in WordPress How to extend a WordPress block Aug 14, 2024
@ndiego
Copy link
Member

ndiego commented Aug 14, 2024

This article is ready for an initial review: https://docs.google.com/document/d/1LcFuIbbmynZwItnCHPRMmAvtD0KfjgAbv346Omi8cb0/edit

@ndiego ndiego moved this from In Progress to Needs 1st review in Developer Blog Content Board Aug 14, 2024
@justintadlock justintadlock moved this from Needs 1st review to Done w/ 1st Review in Developer Blog Content Board Aug 14, 2024
@justintadlock
Copy link

Good job, @ndiego! Just a few suggestions in the doc.

@ndiego ndiego moved this from Done w/ 1st Review to Needs 2nd review in Developer Blog Content Board Aug 14, 2024
@juanmaguitar
Copy link
Contributor

I did a second review and left some minor suggestions, but the article is rock solid and ready to be shipped! ✅

@ndiego ndiego moved this from Needs 2nd review to Done w/ 2nd review in Developer Blog Content Board Aug 15, 2024
@ndiego ndiego moved this from Done w/ 2nd review to Ready to publish in Developer Blog Content Board Aug 15, 2024
@ndiego
Copy link
Member

ndiego commented Aug 15, 2024

Pre-publishing checklist:

  • Post Title and subheaders in sentence case
  • Are Category or Categories selected?
  • Are Tags identifies?
  • Is there an explicit Excerpt?
  • Are all images files uploaded to the media library
  • Do all images have an alt-text?
  • For TOC us the Pattern under Developer Blog > Table of contents
  • Assign or upload a featured image
  • Props added? (See Guidelines)
  • add copy for a social post as comment to this issue (Beyond Block Styles: Part 2 #152 (comment))

Post-publishing checklist

  • add Props for reviews to #props channel in WP Slack (Example) (use Slack handles)
  • Add the label "post to social" to the issue
  • close the issue with a comment to link to the published post
  • close the accompanying discussion with the link to the published post.

@ndiego
Copy link
Member

ndiego commented Aug 15, 2024

Social copy:

Building custom blocks is a key part of WordPress development, but it's not always the best approach. Discover how to customize and extend existing WordPress blocks to meet your needs in this latest Developer Blog article.

https://developer.wordpress.org/news/2024/08/15/how-to-extend-a-wordpress-block/

@ndiego
Copy link
Member

ndiego commented Aug 15, 2024

This article has been published: https://developer.wordpress.org/news/2024/08/15/how-to-extend-a-wordpress-block/

@ndiego ndiego closed this as completed Aug 15, 2024
@ndiego ndiego moved this from Ready to publish to Published (Done) in Developer Blog Content Board Aug 15, 2024
@ndiego
Copy link
Member

ndiego commented Aug 15, 2024

Social scheduled for 8/21/2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Published (Done)
Development

No branches or pull requests

4 participants