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

Blockify everything, prefering HTML+blocks rather than patterns. #1

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

dd32
Copy link
Owner

@dd32 dd32 commented Mar 1, 2024

PR'ing this against my own repo intentionally for a self-reminder. This is probably going to go stale very quickly, but that's OK.

This was a trial-run at removing some of the template-parts and using block templates instead instead of pattern hacking.

Things I ran into:

  • wp:query works, but I ran into shortcomings around the blocks available via it.
  • When using wp:post-template you can set the className on the <ul> but you can't set the class on the <li> (which is what the post_class is). This lead to a str_replace on the block render HTML to add plugin-card to the plugin-cards, later fixed by using a different CSS selector instead.. Unable to add a class to query block list item WordPress/gutenberg#41441
  • When using wp:post-template you can't define a "top level" block, so the "plugin-card" block is actually only the contents of the node that it would be rendered as, ie. it's all of the contents inside the <li>....</li> not including the li tags.
  • A bunch of template tags I wanted aren't present.
    • I made a wporg/missing-template-tag eval block for this, and I quite like it as a hacky fixer.
    • <!-- wp:wporg/missing-template-tag {"function":"the_archive_description","args":["<div class='taxonomy-description'>", "</div>"]} /-->
    • <!-- wp:wporg/missing-template-tag {"function":"the_posts_pagination"} /-->
  • Blocks are rendered before wp_head fires, so there's some customization on archive titles that doesn't apply to the block rendered header.
    • This is probably OK for us, as we'd probably want to use our own search archive template header/title and probably the same for the archive.
    • As a proof of concept, I tried to convert it to a variation of the query-title block which was laughable. See 9260f8f

@dd32 dd32 force-pushed the plugins/2024-theme-try-to-remove-patterns branch from 0c3ce20 to f1a0127 Compare March 1, 2024 06:15
@dd32 dd32 force-pushed the plugins/2024-theme-try-to-remove-patterns branch from f1a0127 to a287730 Compare March 1, 2024 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant