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

Add baseline post format support #17

Open
5 of 6 tasks
justintadlock opened this issue Jul 11, 2024 · 1 comment
Open
5 of 6 tasks

Add baseline post format support #17

justintadlock opened this issue Jul 11, 2024 · 1 comment
Assignees
Labels
🧪 Enhancement Spinning up new features in the lab. WordPress Issue Whatcha doin' to me WordPress/Gutenberg?

Comments

@justintadlock
Copy link
Contributor

justintadlock commented Jul 11, 2024

Currently, there is not much support for post formats in block themes, as outlined in this ticket:

However, there are some foundational things we could explore to add some basic theme support:

  • Add a custom filter to the Query Loop block to query by post format.
  • "Register" existing post format archive templates with a custom title and description that appear in the UI.
  • Filter the template hierarchy to add single post format templates.
  • Register the single post format templates in the UI.
  • Filter the template hierarchy to remove the post-format- slug prefixes and cleanup the template names (e.g., taxonomy-post-format-image.html would be nicer than taxonomy-post_format-post-format-image.html).
  • Add a variation to the Post Terms block for the post_format taxonomy.
@justintadlock justintadlock added 🧪 Enhancement Spinning up new features in the lab. WordPress Issue Whatcha doin' to me WordPress/Gutenberg? labels Jul 11, 2024
@justintadlock justintadlock self-assigned this Jul 11, 2024
justintadlock added a commit that referenced this issue Jul 11, 2024
This filters `single_template_hierarchy` to add single post format support in the form of `single-post-format-{$format}`. It also registers these templates in the UI via the `default_template_types` filter hook.

See: #17
@justintadlock
Copy link
Contributor Author

justintadlock commented Jul 11, 2024

To get post format support for the Query Loop block, I enabled rest_api for the post format taxonomy (didn't add it to the theme because this is Core/plugin territory):

add_filter('register_post_format_taxonomy_args', function($args) {
	$args['show_in_rest'] = true;
	return $args;
});

This works on the front end. But in the editor, the spinner just keeps spinning and never loads posts (maybe there's a need for a custom REST controller):

image

I could dive into this more and add custom controls to the Query Loop block, but I'll leave this for the time being. May revisit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧪 Enhancement Spinning up new features in the lab. WordPress Issue Whatcha doin' to me WordPress/Gutenberg?
Projects
None yet
Development

No branches or pull requests

1 participant