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 · 72 comments
Open

Bring post formats to block themes #53049

draganescu opened this issue Jul 27, 2023 · 72 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
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.

@jameskoster
Copy link
Contributor

The flag would not be missing, just not so prominent in the UI. Post formats would be assigned automatically based on the blocks in the post, like Matias suggested above. The benefit to this is that the user is no longer burdened with choosing the appropriate format – posts fluidly move between formats automatically so that you don't end up with an Image post that contains an Video.

@draganescu
Copy link
Contributor Author

draganescu commented Aug 30, 2023

Hm, that would require us to define the template that makes a post each format:

  • one video, video format
  • one image, image format
  • one quote, quote format
  • one gallery, gallery format
  • one link (we could detect), link format
  • one audio, audio format

This leaves status, chat and aside as hard to figure out. I think - we can deprecate, not support in block themes, chat, makes little sense anyway in core.

Status and aside seem to kinda be the same (considering that even the original inventor of "status" X.com turned them in asides via larger char limit). So how could we figure out asides? Asides are generally titleless text only posts? 🤷🏻

Post formats would be assigned automatically based on the blocks in the post,

This is already happening if the theme supports formats. What I want is to land in the block editor and have the format blocks for that format already there.

so that you don't end up with an Image post that contains an Video.

This shouldn't happen already.

I wonder how formats could be also extended. In a future where wordpress becomes more social (see https://indieweb.org/WordPress and https://wordpress.org/plugins/indieweb-post-kinds/) we still need formats that are composed of preset "templates" so it's easy for decentralized consumers to know what's being posted.

@jameskoster
Copy link
Contributor

So how could we figure out asides? Asides are generally titleless text only posts? 🤷🏻

I think there's a reasonable argument to be made that things like aside / status are just title-less posts. But if we did want to perpetuate them it would be relatively simple to do if we utilised the partially synced pattern approach – patterns categorised as 'status' would appear as design options in the "Add aside" flow.

This is already happening if the theme supports formats.

It is? I only see a soft suggestion to change the format. This one:

What I want is to land in the block editor and have the format blocks for that format already there.

I suppose this could be a good v1. A dedicated quick-post UI could come later (or not at all!).

@jasmussen
Copy link
Contributor

I would caution against inceasing the surface area of the post format selector, or even locking you in to one, because one of the primary benefits of the block editor is that you can actually mix and match post formats if you so please. IMO a great user experience would be that you never had to pick the actual post format — but that the visual appearance met your expectations in terms of asides, titleless, etc.

To that end, I'd just caution against moving too fast on this one, we do risk resurfacing some of the issues that led to the block editor initially.

@aristath
Copy link
Member

aristath commented Aug 31, 2023

I'm confused...
If I remember correctly, for the past few years there have been lots of discussions to completely deprecate post-formats, and the argument was that now that we have blocks, the "post-type" can be derived from the content itself (so if a post has just an image it should be treated as an image post-format and so on).
Is that no longer the case? Do we need post-formats? Or should we derive them from the content? 🤔

@lee-costa
Copy link

@draganescu I really like your plugin and would love to use this simply for the image format. Any plans for a production release?

@colorful-tones
Copy link
Member

Hi folks,
We are only one week away from the Beta 1 cut-off date for WordPress 6.6. This issue hasn’t seen any movement in a while, so we (the editor triage leads of the 6.6 release) have decided to remove it from the WordPress 6.6 Editor Tasks project board.

@nickbohle
Copy link

  • 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.

A quick addition, IMO, format specific archives already exist, but not for „standard“ posts. The post format base in the permalink structure is /type/. So, type/image/ or type/quote/ link to the specific post format archives (using the standard archive template).

It is worth to mention, that in Twenty Twenty-Four the archive title is the translated name of the post format. Category or tag archives have the title „term: Name“ in TT4.

@courtneyr-dev
Copy link
Contributor

I am considering these as an MVP in a default theme, and what could be iterated upon in future themes @mtias.

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.

Would you think an option to solve the quick posting could leverage the pattern modal? Would the implementation be to present the pattern modal when a user creates a post OR to make Tumblr-like buttonsakin to @alexkingorg's vision here

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

Are you indicating the ability to display the heading on the front of site, or the lift needed to omit titles in conjunction with storing posts to the database?

  • giving customization options for posts that have a single or primary block type present.

My initial vison was to have the relevant format > block be first, with paragraph and headings permitted after.

  • instead of soft-suggesting a format it can be switched automatically.

Yes, if the first block is ___ then the format is ____. This could help the POSSE efforts as well. cc:

I am also thinking about how Twenty Thirteen has unique template per format as well that shows in the full blog loop, as well as on single posts. Connecting the first block to save the format with the template selected would be helpful, so long as users could override the automated selection upon save.

Could this get off the ground for Twenty Twenty Five?

cc: @pfefferle

@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.

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