Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Post format archive templates #17

Closed
carolinan opened this issue Jul 15, 2024 · 8 comments
Closed

Post format archive templates #17

carolinan opened this issue Jul 15, 2024 · 8 comments
Labels
Gutenberg A bug or enhancement that needs to be solved in the Gutenberg repository [Status] Blocked Used to indicate that a current effort isn't able to move forward

Comments

@carolinan
Copy link
Contributor

It has probably not gone unnoticed that there is a request to add support for post formats to block themes in general and Twenty Twenty-Five.

Currently, there are only two things that the theme can do to support post formats:

  • Register them using the theme support (Post formats are not enabled by default) add_theme_support( 'post-formats')
  • Include HTML templates for the post format archives.

From the theme developer handbook:

In the case of post formats, the taxonomy is ‘post_format’ and the terms are ‘post-format-{format}. i.e. taxonomy-post_format-post-format-link.php for the link post format.

https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-taxonomies

@justintadlock
Copy link
Contributor

I did quite a bit of exploration for post formats here: x3p0-dev/x3p0-ideas#17

It's probably a bit more involved than we'd want to include a default theme, but just sharing in case any of it's useful.

@beafialho
Copy link
Contributor

What else is needed from design here? There are "post format" templates mocked up here.

@carolinan
Copy link
Contributor Author

Then I will remove the needs design label.

@carolinan
Copy link
Contributor Author

@beafialho The theme can include archive templates for post formats. But not templates for single post formats. It is not part of the template hierarchy.

@carolinan
Copy link
Contributor Author

carolinan commented Aug 27, 2024

Hm, actually that does not work either. When the query loop is set to inherit the query from the template, the editor shows all posts, but the front shows the correct post with the expected format.

Branch for testing: https://github.com/WordPress/twentytwentyfive/tree/add/post-formats
Create a new post and assign it the link format. Save.
Go to the front of the site and add type/link : yoursite.domain/type/link.
Confirm that the archive shows the post you created.
In the admin toolbar, select "Edit site" to open the template for the link format.
The query block, which is supposed to inherit the parameters from the template, shows all posts.

@carolinan carolinan added Gutenberg A bug or enhancement that needs to be solved in the Gutenberg repository [Status] Blocked Used to indicate that a current effort isn't able to move forward labels Aug 27, 2024
@jasmussen
Copy link
Contributor

I can confirm your steps.

Post:
Screenshot 2024-09-24 at 13 03 43

Frontend:

Screenshot 2024-09-24 at 13 03 25

Editor:

Screenshot 2024-09-24 at 13 03 32

Is that WordPress/gutenberg#53049 that needs to fully be addressed?

Thinking. The beta is around the corner. TT5 is meant to be a blogging first theme. The post formats work on the frontend, and there's even a "Format" type in the status inspector, already shipping with WordPress. The remaining piece is indeed the admin templates. Given that this format selector already ships, is the missing template type and handling a blocker for this feature to be included in Twenty Twenty-Five? I'd tend to think your branch could be worth merging and seeing if we can fix the bug of the missing template in the block editor post Beta 1. I may be able to wrangle help. Perhaps @draganescu?

@carolinan
Copy link
Contributor Author

carolinan commented Sep 24, 2024

There is one bug fix plus the PHP "backport" to core that still needs to be finished for the query loop filter.


These are the two tickets I opened but did not find time to work on:

Post Formats: Query loop shows the wrong posts when inheriting the query from the post format archive template
WordPress/gutenberg#65320

Post formats: Archive templates have no description and use the slug instead of a readable name
WordPress/gutenberg#65319

Besides that, it is not possible to create post format templates (of any kind) in the Site Editor.


The theme could create custom post templates, one for each supported format, but supporting that long term is trickier if the feature is introduced.

@carolinan
Copy link
Contributor Author

If the query loop contains multiple formats, say, standard and video, there is no way to use different blocks for the video.
Well, not without "hacks".

@carolinan carolinan closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Gutenberg A bug or enhancement that needs to be solved in the Gutenberg repository [Status] Blocked Used to indicate that a current effort isn't able to move forward
Projects
None yet
Development

No branches or pull requests

4 participants