-
Notifications
You must be signed in to change notification settings - Fork 56
Custom Post Types for Post Grid Blocks #245
Comments
Hi there, A few users have brought this up, but my hesitation is that CPTs usually require a very specific display of content. I'm not sure the post grid would be the best place to display custom content provided by CPT's unless it also had settings to account for these variables. We're still open to the idea, but we'd need to flesh out how to handle very custom things in a generic way. |
Yeah, I get it. When those CTPs look pretty much like regular posts, the Post Grid Block would be a good fit.; but for CPTs with very specif custom fields it would be not… |
Came here to say this :). Understandable that not all CPTs would play nice, but I'd say the majority are still using the normal WP title / content / excerpt / featured image / author, etc. So out of the box it would have good compatibility for the majority. Optionally, some filters in here could also be nice: https://github.com/studiopress/atomic-blocks/blob/develop/src/blocks/block-post-grid/index.php#L15 For anybody needing this, the workaround is not super ideal but could also be much worse. I really like the atomic blocks implementation of this recent post block type, so I decided to stick with it. To add custom post type support, you can unhook the block registration ( |
I would find this very useful with the same output but with all CPTs that are enabled with the REST API available. I've wished for this a few times during some recent projects. Many times I need to show a set number of featured posts from different CPTs along with other page content and a block would be idea for this scenario. For example, an about page that displays some blog posts, some team members, resource items, and press items with their respective posts being organized in CPTs. I see the complications with using this for an CPT archive and whilst that can be a bit of work I think archives are best defined in your theme using the template hierarchy. Thanks for considering this! |
Just set up a site that uses AB post grid, and not having the ability to add CPT's seems like it isn't fully supporting core functionality. It wouldn't be too hard to add this capability either. is there a PR for this yet? |
Hey folks, this is definitely still something we're looking at. As mentioned before, with so many people using Atomic Blocks and the post grid particularly, it isn't something we can just add without changing how the current block works. CPTs can opt in or out of supporting various features such as featured images, author, excerpt, title, etc. The block UI should reflect this support so we aren't showing empty controls that don't toggle anything. Taking an unmeasured approach leaves us constantly revisiting the block to address these considerations. We'll definitely consider the ongoing interest into our roadmap! @rfair404 I disagree with this line of thinking that the block is somehow not supporting core functionality. The core Latest Posts block would be guilty of the same. It would also mean that infinitely variable and customizable CPTs needed to be considered the same as posts and pages by every plugin, theme, and block created. This block is for posts and pages, currently, and it supports those well. |
Also came to GitHub to look for a filter to register my own CPT with this block. I don't think the block needs to support all registered CPT by default but should be filterable. |
Just a note for later. In the case of supporting CPTs via a filter or similar, we need a way to allow for the same with custom taxonomies - or update our code to be smart enough to detect which taxonomies are attached to the selected CPT, along with the other features mentioned above. |
Nowadays seting up an archive template for CPTs takes quite a bit of work and some coding.
It'd be great to be able to use the Post Grid block to display a list of posts of a certain CPT, beyond regular posts and pages.
The text was updated successfully, but these errors were encountered: