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

Bring post formats to block themes #53049

Open
draganescu opened this issue Jul 27, 2023 · 76 comments
Open

Bring post formats to block themes #53049

draganescu opened this issue Jul 27, 2023 · 76 comments
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Enhancement A suggestion for improvement. [Type] Feature New feature to highlight in changelogs.

Comments

@draganescu
Copy link
Contributor

draganescu commented Jul 27, 2023

What problem does this address?

WordPress supports post formats since version 3.1 (year 2011). In block themes one can use functions.php to add support for post formats, but then that's about it.

What is your proposed solution?

  • Add a new type of template which is aimed at displaying a post of a specific format - basically, add built in support for formats in the site editor
  • Introduce fomat specific archives (all asides, all videos) - this has to be specific for block themes as the archive itself does not exist in WP by default.

Formats are a powerful feature. They do have overalpping purposes with custom post types and custom templates, but as a user experience they sometimes make a lot more sense, for example if you want a simple log (not blog, nor magazine, not shop) website.

@draganescu draganescu added [Type] Enhancement A suggestion for improvement. [Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Feature New feature to highlight in changelogs. labels Jul 27, 2023
@Mamaduka
Copy link
Member

Related #45866. cc @courtneyr-dev

@jasontucker
Copy link

This need to happen

@carolinan
Copy link
Contributor

I think it is a matter of adding post formats to the template hierarchy.

@boogah
Copy link

boogah commented Jul 28, 2023

I am dying to get this feature into Gutenberg — and eventually WordPress core. Happy to do whatever I can to help!

@draganescu
Copy link
Contributor Author

draganescu commented Aug 8, 2023

Having had separate discussions with folks from the @WordPress/gutenberg-design here is what I learned:

  • post formats are overlapping with many current features such as CPTs and CPT templates, block patterns and block templates, block templates which work only in specific template types
  • post formats were originally aimed at rendering certain posts differently in the loop less so for rendering a different template, although that was possible
  • one item that seems missing in the site editor is not so much post formats as conditional rendering which is available in classic themes
  • a post with one block, say a quote, and no title is effectively a post format. So is appears what we should focus on is improving:
    • handling of title less posts in the loop and in templates
    • the new post flow where one should be able to start with a pattern
    • the specific formatting of the post content bloc in the query loop

@SaxonF
Copy link
Contributor

SaxonF commented Aug 8, 2023

@boogah could you tell us a little bit about when you last needed post formats? As @draganescu mentioned we are thinking through whether there are more flexible, alternative ways to solve some of the problems post formats did.

@boogah
Copy link

boogah commented Aug 8, 2023

My biggest use case for post formats has been one that hasn't really come up yet. At least not in this conversation. 😉

Link posts.

Video, audio, quotes, asides, and status posts (as well as the others I didn't bother listing off) would all benefit from improved handling of titleless posts, I agree. As would a post flow where a user can pick the pattern for the post they're trying to craft.

Link logging is something that I enjoy doing. On the days that I don't feel like writing a full post, I usually have a link in my back pocket that I'd like to be able to share. It'd be great to have a way to natively do that in WordPress as it is today instead of falling back to a classic theme or hack something to make link posts work.

@Ipstenu
Copy link
Contributor

Ipstenu commented Aug 8, 2023

Video posts, for me, has been the biggest one. Sure I could make a CPT but if I want a video post to show up in the normal post tags and categories, archives etc, and NOT have to worry about training editors, it’s post formats all the way.

Last used last week.

@janboddez
Copy link
Contributor

janboddez commented Aug 8, 2023

Got the same—I think?—issue with CPTs, despite Site Editor support for them.

In search results or when they share tags with regular posts, it’s not uncommon to see the different types listed on one and the same page. Yes, in the loop!

(At the moment I use a super convoluted “hack,” i.e., several strategically placed instances of a dynamically rendered custom block, to display post meta for that exact post type, where I want it for that specific post type. Or format, if you like.)

As for titleless posts, I do a lot of those (using those same CPTs, but they could as well be post formats). The way I deal with them, and “outgoing link titles,” in the case of link posts/bookmarks/“likes,” is I override the Post Title block’s render callback!

(To merely hide a certain format’s titles, one could probably fall back to CSS-based solutions.)

Anyway, it’d be nice (or at least somewhat easier) if there could be several instances of the Post Template—not entirely sure that’s what it’s called—“block” (for one and the same query), one for each format (well, or post type) you would like to support.

@carstingaxion
Copy link
Contributor

carstingaxion commented Aug 9, 2023

In addition to the mentioned use cases, I‘d like to add post-kinds like the #fediverse uses them and all kinds of indieweb POSSE apps.

I have found this many times a nice use-case for the built-in post_formats as they are almost 100% fitting the open-web recommendations.

@jordesign
Copy link
Contributor

One thing i've appreciated in themes that use Post Formats well is within the index page (so equivalently the Query Block) where they have different treatments within the index for different formats (ie. including the video, or a blockquote in the loop instead of title/excerpt).

Like Baskerville (for example).

Screenshot 2023-08-09 at 5 17 34 pm

@mtias
Copy link
Member

mtias commented Aug 9, 2023

Also for reference, there's a bunch of things we already do when handling post formats that don't seem captured here. For example, when the theme supports formats and you only have a single block type in the post content:

image-12

Both in post publish and the settings panel:

image-1-1

Also if you go to Settings > Writing and select a default post format:

image-3-1

Then the editor will render that block by default when you create a “new post” instead of an empty paragraph:

image-2-1

I think the areas to explore are:

  • the ability to create posts with a default block already inserted before you get to the editor — so quick posting for images, links, asides.
  • title-less seems orthogonal and something you should be able to do regardless of content type.
  • giving customization options for posts that have a single or primary block type present.
  • instead of soft-suggesting a format it can be switched automatically.

@MaggieCabrera
Copy link
Contributor

@mtias should post formats be enabled by default on block themes? If the answer is no, should we move that option to theme.json, instead of needing the PHP function?

@draganescu
Copy link
Contributor Author

Yea same question as @MaggieCabrera what's holding us back from enabling formats in block themes by default?

@mtias
Copy link
Member

mtias commented Aug 9, 2023

Mostly the fact that by default they don't do anything, so it'd be pretty confusing to select something that doesn't have a meaningful impact on anything in your site.

@janboddez
Copy link
Contributor

janboddez commented Aug 9, 2023

(Just a side note: I was under the impression that "asides" were the original "titleless posts.")

The "Baskerville" example up there is exactly what I'd love to be able to do when I said target different types of posts in a single query loop.

In a PHP theme, you'd just drop an if statement checking for a certain post format, for instance, or use partials (or whatever they were called) cleverly, and then you could generate entirely different HTML for each format (or type). Super handy for things like adding microformats, too, so it goes beyond just styling.

I guess "better" default blocks are a step in the right direction, but they only get shown (on index or archive pages) when the full post content is displayed. Sometimes you want title and excerpt, or no title, or apply a different class to these (theme) blocks, or show different theme blocks (like, maybe you want an author avatar for asides but not for standard posts) based on the post format. Or lay post meta out in columns. And so on. Such a thing (for block themes) currently requires very "hacky" solutions.

@draganescu
Copy link
Contributor Author

draganescu commented Aug 23, 2023

I made an exploratory plugin which aims to see how defaulting to always on formats impacts content creation flow and the assumptions of the block themes loop.

I think it's pretty impressive how well it works with such little effort. Please test it out just to form some ideas :) - it's not meant for production.

This simple plugin is meant to explore via hacking how post formats can work
with block themes from two perspectives:

  1. How the creation flow for the quick no title content types could work
  2. How the loop could handle quick no title content types

The plugin when activated does the following, if a block theme is active:

  • Enables support for post formats (all)
  • Adds one admin sidebar new post link to a special editor configured for each format
  • Adds a dashboatd widget which contains a
    new post link to a special editor configured for each format
  • Hooks into the rendering of the post template block and renders full content if
    the currently rendered post is any format other than standard
  • Customizes the post editor for format posting by presenting a default template
    per format type and hiding the title input (via CSS).
  • Uses format name as title in WP admin for title-less posts

Demo

wp-format-demo.mp4

@bph bph moved this to 📥 Todo/Needs Dev in WordPress 6.4 Editor Tasks Aug 29, 2023
@bph bph moved this from 📥 Todo/Needs Dev to Needs Design in WordPress 6.4 Editor Tasks Aug 29, 2023
@bph
Copy link
Contributor

bph commented Aug 29, 2023

Thank you, @draganescu The plugin is sooo helpful to visualize what could be happening with post formats. I took if for a spin and here are my first impressions:

While using it on a test site. I created a separate category 'updates' for quotes, status, image and it was great to see how a post template works without the title in an Archive template. The only think, as a content creator I found odd, was the read more link hard-coded in the php render part on the front end. I replaced it with --> short of deleting it from the plugin

It worked almost immediately with the Blue Note theme

Screenshot 2023-08-29 at 17 06 17

I would still need to link to the single post for users who would want to comment on such a post, so I probably would prefer the 'Read more link' feature from the Post template block and call it "Comment here". I'd also add a bubble for the number of comments to the archive page.

single post

I didn't do any single post template modification, so the Admin Title also showed on the Single post, but that would be the next step.

Should there be a single template and conditional rendering as you provided with your plugin or single template for each format?

  • single-quote
  • single-image
  • single-status etc.

For end user control, I am leaning towards a single template for each post format.

Post formats in post list

I like the Admin title identifying the post format for title-less post. There are other options on how to change this:

  • add a column for post format to the list of posts
  • use the first few characters of the title less post to identify it in the post list.

creator entrance.

How the creation flow for the quick no title content types could work

I am a total fan of the single link for each post format. It's not pretty in the Admin right now, but highly functional.

I do like a Tumblr's row of icons.
Screenshot 2023-08-29 at 17 18 47

  • It could be made more WordPress-y and be a drop-down from the 'New post' link in the Admin bar - provided that doesn't trigger major accessibility flags.
  • It would also be cool to have some a Dashboard widget right on top after login, so a user can get their work done without having to find the new post link etc.

it's pretty impressive how well it works with such little effort.

Totally agree! Awesome work.

@jameskoster
Copy link
Contributor

title-less seems orthogonal and something you should be able to do regardless of content type.

Title-less posts essentially works already. When no title is supplied nothing is rendered on the frontend.

One awkward consequence is that you end up with a bunch of "Untitled" posts on the backend which isn't ideal for searching/managing. So one question is whether it should be possible to supply a title but stipulate that it isn't displayed on the frontend.

giving customization options for posts that have a single or primary block type present.
Partially synced patterns are a potential solution here, and for the quick-post UI too. A self-contained flow might look like:

  1. "Quick post image"
  2. Upload the image
  3. Select a design from available partially synced patterns containing only an Image block
  4. Add categories/tags
  5. Publish

instead of soft-suggesting a format it can be switched automatically.
Agreed, this seems like something that can be implemented now.

On the technical side, one issue to address is how the Excerpt block handles images and other embeds. Currently, if the Query Loop includes an Excerpt (rather than Post Content), and a post contains only an image, then the Query will not output that image. Did you have any ideas how to handle this @draganescu ?

@draganescu
Copy link
Contributor Author

@jameskoster #53465 is an exploration on making the excerpt block outputt the 1st block if there is no title.

In my plugin exploration however I look at the format itself and output the content if the format is not standard, thus circumventing the issue with excerpts in query loop.

Quick post image"

I think the idea to discard formats for flows is promising but we'll always want to do things different for these one off content types and missing a flag to denote them being "different" is gonna cause limitations.

I agree that there should be a way to post title-less content even for standard formats. I think the work of @ockham with block hooks could be a path to "turning off" title.

@carolinan
Copy link
Contributor

carolinan commented Jul 5, 2024

Traditionally, post formats are chosen after you have already created a new post. What I mean is that you select "Add new post", and then select the format. How would selecting it before you create it work? What should happen if I want to change the format while I am editing?

What if I have created a new standard post already and added content, and then switch to the image post format, does WP automatically insert an empty image block?
There are many questions that needs answering and exploring.

@tomfinitely
Copy link

tomfinitely commented Jul 5, 2024

@courtneyr-dev's push for in-built POSSE features is a huge marketing win for the advancing of WordPress (for both hobby users as well as orgs, brands, and agencies), not to mention it finally brings parity to various efforts kicked off within the past year to integrate with the Fediverse.

@carolinan does it have to be an either/or binary? Seems like giving people the ability to choose up front and switch formats after the fact makes the most sense. I get there could be some complications in terms of migrating content appropriately in the "post facto" scenario, but content authors are undoubtedly going to encounter situations where they want to switch formats, and we already more or less had that ability before. How was it addressed back then?

Other points to consider:

  • IMO we really need to heavily consider post format and block options for syndication to video and image services since that is where a lot of concern has been focused with regard to platforms taking undue license with absorbing people's content sans consent. Single post and archive pages that have similar aesthetics to IG/Pixelfed or Youtube/Peertube would make the most sense as a start point.
  • @Mamaduka's Bookmark Card plugin is a great example for how the link format could render.
  • We should consider that people are going to want to reference things like, say a video or image post, within long form blog posts. What does that look like?
  • How do we make sense of this from an RSS standpoint?

UPDATE:

Seems like the pattern transform capabilities rolling out in 6.6 can handle post format switches.

@tomfinitely
Copy link

tomfinitely commented Jul 5, 2024

Apologies if this isn't relevant to the discourse and for the unsolicited tagging of people in — but as a matter of efficiency and to avoid retreading perfectly good wheels, I believe there is merit in referencing prior art along these lines:

@carolinan
Copy link
Contributor

carolinan commented Jul 11, 2024

  • I suggest discussing the titleless content and the conditional displaying of blocks as separate issues since it is not limited to post formats.

Creation

I have read all the comments and there seems to be three suggestions, not mutually exclusive:

  • Fully automated. Assign the post format term upon saving, depending on what content is in the post.
  • By making quick posting available attached to the "New post" button /dropdown etc
  • By making the choice in the pattern creation modal for posts.

Presentation

  • It is already possible to display a single image, video, or titleless content in an archive if the archive is set to showing the full content, because WordPress defaults to not showing a post title if one is missing.
  • It can be undesirable to show the full post content for longer posts, so there could an option on the query loop to display the formats. I would prefer it to be up to the user, much like the existing filters, rather than strictly enforced.

Help third party services identify the content type

  • I don't have enough knowledge about this, if I understand the comments correctly, using a the "post" post-type with an image, video, or titleless content, but without a registered post format, is not enough to correctly identify or classify the content type?
    Link to Slack conversation
  • What do WordPress need to do here, and where should the line be drawn between core and plugin territory?

@justintadlock
Copy link
Contributor

Just sharing some quick thoughts while fresh on my mind.

What are post formats?

I think it's helpful to break down just exactly what post formats are:

Primarily, they are an identifier, a way for users to say, "e.g., my post is an aside." This information is then conveyed to the theme, and the theme decides how it should be displayed on the front end (e.g., whether it should show the title, a change of colors, etc.).

Current roadblocks

The fundamental problem that was introduced with block themes is the lack of conditionally displaying different designs based on the assigned format. There are two primary areas where themes need control:

  • Query Loop / Post Template blocks
  • Single post templates

Block theming has introduced a new hurdle that was not present in classic themes: Query Loop patterns. In most classic themes, you had one Query Loop design. It was easy to call get_template_part('content', get_post_format() ? : 'standard') and load a "content" template part for all queries.

Today, block themes can potentially ship dozens of Query Loop patterns, each with unique layouts and potentially each with the need for handling post formats so that they fit within that context.

There are also entire libraries/scripts that themers built for pulling things like featured media (e.g., audio, video) within Query Loops. WordPress does not have blocks for those situations or Block Bindings support for the Audio and Video blocks.

How were post formats handled in classic theme Query Loops?

When displaying formatted posts inside of the Query Loop in the past, here is how I treated them (list broken down by similarities):

  • Short posts:
    • Aside: Generally, I'd remove the title and just show the post date under the content.
    • Status: Mostly, I'd treat this like asides. Sometimes, I'd have a custom field for adding an emoticon or emoji.
    • Link: Mostly, I've treated these like asides, but sometimes I pulled the link from the post and display it by itself.
    • Quote: If the post had a <blockquote> tag, I'd display it. Otherwise, I'd wrap the entire output in a <blockquote>. I'd also remove the title.
  • Media posts:
    • Gallery: I'd pull the gallery from the post and show X number of images. Alternatively, depending on the design, I'd pull a single image and display it.
    • Image: I'd pull the media out of the post and display it.
    • Audio: Same as Image.
    • Video: Same as Image and audio.
  • Hot mess:
    • Chat: I actually had an entire script for parsing this, but the chat format has always been an oddball that few people really knew how to handle.

@melodykramer
Copy link

melodykramer commented Jul 11, 2024

Hello! I found this discussion while searching for relevant discussions related to "post formats." I help run a civics blog in Chapel Hill and Carrboro, North Carolina called Triangle Blog Blog. We are a group of volunteers who basically provides news and commentary about our region. We are very interested in "kottke.org-ifying" our stream, that is, we would like to switch to a theme that allows us to easily post:

  • a short quote
  • a video
  • an image
  • a gallery
  • etc.

I used to run the NPR Fresh Air tumblr, and we envision something like that. Most of the volunteers I work with are not tech savvy. It would be wonderful if they could hit a Tumblr-like button from within Wordpress and have their "post type" automatically appear.

This is a long way of saying we'd be happy to kick the tires on this concept, and think it would be extremely useful for our use case, which is basically to provide ongoing news about our region to our community, in a variety of formats that are not always using the "regular post" view.

@nickbohle
Copy link

@justintadlock Thanks for sharing your thoughts. Today, I've commented on #PostFormats in #WordPress' new default theme here.

I agree with the initial purpose of post formats, but with the Ephemera widget in Twenty-Fourteen, you could already display post format posts in your sidebar. So, already back then, post formats could be used as a third (design-baed) taxonomy (besides the content driven categories and tags). This was furthermore supported with the slug /type/ for post formats.

What I would suggest is to concentrate on the low hanging fruits first. So:

  1. Allow querying the "standard" post format.
  2. Add post formats as a fourth filter to the query loop block.
  3. Allow / create archive templates (e.g. archive-image.html) and single post templates (e.g. single-image.html) for post formats
  4. Make the post format slug /type/ editable / translatable.

Concentrate on the design restrictions (e.g. what content should be stripped not allowed?) of post formats in a second phase. This way, it could be analyzed how post formats are used in a Gutenberg world. Based on the obtained data, decisions could be made more easily.

@carolinan
Copy link
Contributor

So to allow the archive and single templates, I come back to the comment posted last year:

I think it is a matter of adding post formats to the template hierarchy.

And I think they need to be added for all theme types not only block themes.

@nickbohle
Copy link

And I think they need to be added for all theme types not only block themes.

I agree, even though Twenty-Thirteen already had content-PostFormat.php templates. Link to core.

@tomfinitely
Copy link

tomfinitely commented Jul 11, 2024

This may be a difference in all our communication styles, but following up on what @melodykramer was articulating, I believe it's critical to state the Query block (or a similar variation) should serve as a catch-all or firehose for post formats. This would allow each format to render appropriately and enable site owners to include or exclude any combination of formats in the firehose feed.

From my perspective, it’s not enough to just envision “what it does”—it’s also about understanding the why. My use cases align with Melody’s, where the core handles post formatting, so my writers don’t have to worry about it. A plugin like ActivityPub or something similar would then handle multiplexing to federated networks. From my decade-plus experience in various verticals and agencies, what would delight many people is the ability to post an image on their site and have it automatically appear on Instagram, or a text post on Mastodon or Bluesky, without leaving their site. The actual connection and broadcasting out to external networks part of the process should definitely fall under plugin territory.

Creating a WordPress framework/API to make this multiplexing dream a reality is what I suspect this resurgence of post formats is about for many of us, as much as just having a low-stakes "social" feed of our own. It would significantly help publications and businesses save valuable time and make the process enjoyable and effortless for hobbyists. That’s democratizing publishing—empowering people to own their content on their site first and foremost, and optionally establishing a bidirectional relationship with external digital properties.

@melodykramer
Copy link

melodykramer commented Jul 11, 2024

I agree with @tomfinitely. Right now, our default is to post to X for links/graphics/etc - and there's no great alternative. (And many of our writers/readers are no longer on X and have no place to put these 'bits.') That's become the catch-all. I would much rather post all of these "bits" to Wordpress and have them go everywhere.

Here's an example: - would have loved to make that a graphic + caption.
image

@justintadlock
Copy link
Contributor

justintadlock commented Jul 11, 2024

What I would suggest is to concentrate on the low hanging fruits first. So:

  1. Allow querying the "standard" post format.
  2. Add post formats as a fourth filter to the query loop block.
  3. Allow / create archive templates (e.g. archive-image.html) and single post templates (e.g. single-image.html) for post formats

@nickbohle Oh, absolutely, these are big foundational items that are necessary before we can get true block theme support.

The query is possible now but requires you to write JS and PHP for a block variation. That would be an easy win, I'd think, to add to Core.

Archive templates are already supported: taxonomy-post_format-post-format-image.html. The name is not pretty, and it'd probably be worth stripping the post-format- prefix from the slug in get_taxonomy_template() for a nicer developer experience. I don't think this is a "registered" template in the UI, so it might just show the filename instead of a label. Supporting these in the UI would be huge.

Single templates do not currently support post formats without a custom filter, and this would be a relatively straightforward thing to add in the get_single_template() function.

I'm going to do some experimenting to just try adding some baseline support for these things to see what it looks like. Good callout to refocus on the basics. 💯

@nickbohle
Copy link

@justintadlock, thank you very much for your reply.

The query is possible now but requires you to write JS and PHP for a block variation. That would be an easy win, I'd think, to add to Core.

I used the following patch for the standard post query for serval years. Link to trac.Yes, it is quite old.

Archive templates are already supported: taxonomy-post_format-post-format-image.html. The name is not pretty, and it'd probably be worth stripping the post-format- prefix from the slug in get_taxonomy_template() for a nicer developer experience. I don't think this is a "registered" template in the UI, so it might just show the filename instead of a label. Supporting these in the UI would be huge.

I could not wait and just tested it by copying the archive.html and renamed it to taxonomy-post_format-post-format-image.html. Yes, the name in the template table is not pretty, but it works like a charm. Also edited the template that it only shows the featured image and the title, but no content. See: /type/image(

Single templates do not currently support post formats without a custom filter, and this would be a relatively straightforward thing to add in the get_single_template() function.

Well, what I already did before is to create a custom single post template with no featured image, then I bulk edited all post format image posts and assigned the new template to them. So, so archive shows the featured image now but no duplicate image on the post itself.

I'm going to do some experimenting to just try adding some baseline support for these things to see what it looks like. Good callout to refocus on the basics. 💯

Thanks again!

@nickbohle
Copy link

nickbohle commented Jul 14, 2024

I don't think this is a "registered" template in the UI, so it might just show the filename instead of a label. Supporting these in the UI would be huge.

For informational purposes, after editing and saving the template file, the unattractive name in the UI „taxonomy-post_format-post-format-image.html“ is updated to „Format: Image“ with the description „Template for Image.“.

And @justintadlock, thanks again. My new archives for posts with the type image or quote in Twenty Twenty-Four. More details here.

Screenshot archive for image posts with featured image and title. Three images per row.
Screenshot archive for quote posts Without featured image, but with title and block quote. One quote per row.

@asuh
Copy link

asuh commented Jul 14, 2024

I second what @carstingaxion says about Post Kinds, a plugin that was created with similar intentions to Post Formats.

https://github.com/dshanske/indieweb-post-kinds/

Reintroducing post formats & merging post kinds with default support in WordPress core would be a big win for the open web and fediverse.

@carolinan
Copy link
Contributor

I found that all that was needed to be able to create archive templates for the post formats, using the "Add new Template" button in the Site Editor, was to to enable 'show_in_rest' for the post format taxonomy.
I am setting show_in_rest to true in 64167.

@carolinan
Copy link
Contributor

I found that all that was needed to be able to create archive templates for the post formats, using the "Add new Template" button in the Site Editor, was to to enable 'show_in_rest' for the post format taxonomy. I am setting show_in_rest to true in 64167.

In review of 64167, setting show_in_rest to true is discouraged, so this can not be used as a solution for enabling creating the templates.

@alexstandiford
Copy link

alexstandiford commented Sep 11, 2024

I know this is a long conversation, but want to add into this that the entire reason why I'm using post formats is because it is the only way to create different types of content on a website using the mobile app.

I use my entire site as a central hub, and that means that I'm posting everything through that first. Tweets, videos, blog posts, all of it. This means that I'm frequently using the mobile app to publish.

If it were possible to make custom post types display in the app, I'd probably be more open to using them instead of post formats, but since that's not the case, I really think we need to have better support for post formats in themes.

I think it should be possible to turn a blog archive into a "feed", where different formats appear differently in the feed based on the format. This might mean extending the post template blog so that you can specify how a post looks for different formats - that would be awesome.

It would also be great if there was a way to customize the layout of single post pages based on post format.

Edit:

In the meantime, I've been able to solve most of the problems related to limitations with support for post formats using a couple block plugins, and a PHP snippet that makes post formats readable as post metadata.

https://www.alexstandiford.com/articles/essays/tutorials/how-i-made-my-wordpress-archive-style-different-post-formats/

@nickbohle
Copy link

nickbohle commented Sep 11, 2024

What is already possible with plain vanilla WordPress, default theme Twenty Twenty-Five and a simple plugin that activates Post Formats in TT5?

I think it should be possible to turn a blog archive into a "feed", where different formats appear differently in the feed based on the format. This might mean extending the post template blog so that you can specify how a post looks for different formats - that would be awesome.

A combined feed of different post formats is not yet possible, but you can create separate archives templates for the different post formats. They will have the slug /type/ and even have their own RSS feed, e.g. /type/image/rss. A lot of dev time (#64167 thank you all) is invested to filter the post formats with the Query Loop Block, when it is implanted, you can have different „format“ feeds on one template.

It would also be great if there was a way to customize the layout of single post pages based on post format.

This is also already possible when the respective templates are created and applied to the new post (unfortunately, the second step is not yet possible in the iOS WP app but it works in the mobile browser. )

More details on the How can be found here

@hansschuijff
Copy link

@alexstandiford Yes. I think the need of what you describe is clear. I hope block themes will offer some way to implement that.

I consider post format as sort of a post type light thing, without the trouble of formalizing the content by adding custom fields. Both are basically a way to mark an entry for some kind of formatting, but post types are often extended with custom fields and some custom functionality (from a plugin or theme). Post formats are always meant to show, where post types often can be supportive of a main post type too.

Since using different post-formats in themes normally come with guidelines (or assumptions) on how to setup the content so it will be formatted as intended, it was really not only about formatting, but also about content structure. That makes them a bit like a post-type too, rather than only a format driven marking. Probably it was just an easy way to utilize what was already there with minimal impact on the data model. But the possibility of differentiating different formats in a blog or archive page, was a nice thought.

But having a block editor means the formatting within the post is now as flexible as blocks allow and themes can just offer block styling. So what remains are only the pages that list posts in some way.

You need some way to differentiate different posts types en formats on an archive level and if that archive shows more than one format or post, how to do that in a theme? No problem for conventional themes and hybrid themes that can just program a template part, but how to do that in block themes without the need of programming?

So I agree about the need you state of this kind of functionality, if query blocks are the replacement of queries in conventional theme templates using template parts to do this kind of differentiation. If this is basic functionality in WordPress, then themes will probably use it, or otherwise the admins may use it to enhance the chosen theme.

I don't use the app like you do, but it seems a way of formatting the archive summary of different post types and post formats is a need to be met, at least if block themes want to replace that kind of formatting too. Otherwise block themes may never be able to fully replace the needs of what conventional themes have offer and perhaps will be limited in use. Then the question needs to be asked to the theme devs instead.

Problem for admins is that a basic theme often needs some customization if a plugin/functionality is added to a website at some point. F.i. WooCommerce is often part of premium themes styling, but perhaps events calendar is not, or some course plugin.

When you add such functionality the singles page is often taken care of (mostly) by the plugin, but a custom format for an archive page using a block theme might not be that easy without this functionality. They can add a block for an archive only showing the plugins post_type, but then f.i. the search results are still not displayed in the right formats.

It's a nice challenge, but it's enough of a need to having kept me from using block themes on production websites that I maintain. Courses, products, tickets and events need to differentiate themselves in search results and archives.

@voughtdq
Copy link

voughtdq commented Oct 10, 2024

Just getting back into WP and I love post formats. I don't know a lot about blocks yet, so there might be some ways to achieve what I'm talking about. I know, at least, that it's possible to iterate over the blocks and extract information about them.

I was thinking about how one of the recommendations for link post formats is to get the first link in the post body to use that as the intended link for the post.

In the same way, one could check the first block in the post and assign the post format that way. It would be super cool if blocks themselves could define their own post formats and if a post could be restricted to have a single block. If I remember correctly, there's a way for a block to contain other blocks, so it would be a "post format block" that contains whatever inner blocks one wants.

But anyway, the idea here is get the first block, see if that block is what we want for the post format, then set the post format based on the block. Ideally there would be some way to use the block's metadata to determine the post format.

What do y'all think about this approach? Not sure how this would square with the mobile app, but I think it would be a cool approach to using blocks to set the post format.

@carolinan
Copy link
Contributor

carolinan commented Nov 1, 2024

@draganescu @justintadlock Can you help me narrow down what the next actionable steps are, so that separate issues can be created where the technical solutions can be discussed. This issue is getting more difficult to manage.

@nickbohle
Copy link

After having implemented post formats in TT4 and WP 6.7 beta1 (and higher), please let me extend the list with the following thoughts (not only block theme related):

  • Backend > All posts (wp-admin/edit.php). When post formats are enabled, it is possible to filter posts by format there. The filter options are: All formats and all existing formats with posts. In contrast to the Query Loop Block, it is not possible to filter standard posts there. Why is this filter important? This is, in my opinion, the only place in the backend where single post templates can be bulk edited (e.g. I changed the template for all my"single-image" posts there).
  • Allow / create a post format slug for type/standard (to have an archive for standard posts, I created a new page template with a custom query loop that filters the format standard, but the permalink is not consistent with the other formats. mydonmain.com/standard vs. mydomain.com/type/image/, mydomain.com/type/quote/, etc.).
  • Backend > Settings > Permalinks (wp-admin/options-permalink.php). Allow / make the post format base editable / translatable like categories and tags.

@carolinan
Copy link
Contributor

carolinan commented Nov 2, 2024

@nickbohle I am not sure I understand what you mean with point two. I am reading this comment literally, and if you are creating a new page template and adding a query loop to it, it will indeed behave like a page template, not an archive template.

The standard is not a type of format, rather it is the "lack of" format.

@nickbohle
Copy link

@nickbohle I am not sure I understand what you mean with point two. I am reading this comment literally, and if you are creating a new page template and adding a query loop to it, it will indeed behave like a page template, not an archive template.

The standard is not a type of format, rather it is the "lack of" format.

@carolinan, thank you for your prompt response. Yes, I understand that „standard“ isn’t a real post format. In fact, I used to run a plugin that generated the slug type/standard/ before switching to TT4.

I’d like to have the „Standard“ permalink integrated into the core so that all posts can be accessible not only through the Query Loop block but also through the permalink structure. Since this isn’t feasible at the moment, I created a page with a custom query loop as a (temporary) solution. Apologies for any ambiguity in my previous response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Templates API Related to API powering block template functionality in the Site Editor [Type] Enhancement A suggestion for improvement. [Type] Feature New feature to highlight in changelogs.
Projects
None yet
Development

No branches or pull requests