outofcontrol,
@outofcontrol@phpc.social avatar

Until Wordpress lets us handle their data the way they want, I fail to see that WP can call itself a CMS platform. Main point of consternation is date and future date handling. If I have posts that are set to a future date, maybe I still want to display those on the public area (events anyone?) without needing to install a special plugin for dates. You’re welcome to try and change my mind.

otto42,
@otto42@fosstodon.org avatar

@outofcontrol It seems like you're having trouble showing future posts, and that can be indeed weird if you don't know how future posts or post scheduling works in WordPress. However, it can be done using standard query methods, using custom code in a theme or plugin depending on this specific case.

The thing is, when making a site custom to that level, you kind of have to know code. It's generally not a built-in thing that is easy to access because most people don't need to do that.

outofcontrol,
@outofcontrol@phpc.social avatar

@otto42 That’s my point, one should not need to code to allow future dated posts to appear. It should be a short code with an attribute show_future_posts=“yes” or something simple.

otto42,
@otto42@fosstodon.org avatar

@outofcontrol okay, a) shortcodes are rarely used anymore in the modern editor. That was the point of blocks, to replace shortcodes and everything else. But b) it actually kind of is that simple because all you have to do is set the post_status to future, or any.

I'm pretty sure you can do that with the existing query block, however, I have not tried it myself, but it shouldn't be that difficult to add or adjust it in that way.

outofcontrol,
@outofcontrol@phpc.social avatar

@otto42 If possibly I would love to see that in action. My understanding was that future post type would only be visible for admins that are logged in.

fabiantodt,
@fabiantodt@fosstodon.org avatar

@outofcontrol Oh yeah, I’ve built enough event post types in WP and had to deal with future/scheduled posts 😅🙈 I finally got a snippet that works, but I agree it‘s cumbersome. But I still think, using post_date is the best way to handle event dates (instead of a meta field). It just makes so much more sense.

outofcontrol,
@outofcontrol@phpc.social avatar

@fabiantodt Agree that post_date makes sense. Did you get this to work with a normal query loop in WP? I came close with adding a switch in the query loop settings which set flag to show future posts. But, WP still over-road showing only future dates for anyone not signed in and with permissions to see future posts. It was a clean solution and… “almost” worked!

fabiantodt,
@fabiantodt@fosstodon.org avatar

@outofcontrol
I've put it in a gist here: https://gist.github.com/gaambo/d4723975b7de3d282c5da76c3b8521d2

I use this mostly in custom themes, so often I build queries via get_posts inside custom blocks. But I also used it on normal post type archives.
I just copy/pasted/merged it from a few projects, so don't know if the code runs as-is - but you get the gist 😅

outofcontrol,
@outofcontrol@phpc.social avatar

@fabiantodt To be sure I understand this, you are modifying the post_status on posts that are saved with a future date? Vs trying to work around WPs ‘future’ post_status?

thomastospace,
@thomastospace@phpc.social avatar

@outofcontrol Do you mean just a Post here, or a Post Type?

outofcontrol,
@outofcontrol@phpc.social avatar

@thomastospace I believe the answer is Posts in general. We use ACF to create several post types, one being events. Which is fine for past events, but getting future events to display is troublesome to say the least. Then filtering by category and having both past and future dates show… it seems overly difficult. Coming from a background of ExpressionEngine/Laravel/Grav, where this is a simple tasks. Hopefully this lends enough info to answer your query?

thomastospace,
@thomastospace@phpc.social avatar

@outofcontrol That makes me understand the problem clearly.

The problem is that you're using the publish date as the event date here. The publish date is when you publish the event, not when the event is held.
Better to have a separate date field in ACF for the event date.

Using the publish date as the event date is swimming against the stream and fighting with Wordpress.

I agree it isn't a clear subject though. It would be great if there was more 'How to do Wordpress right' documentation.

outofcontrol,
@outofcontrol@phpc.social avatar

@thomastospace And this is what we did in the end, having an event_start_date and event_end_date.

Replies seem to be mostly, that’s now how WP works or I don’t understand how it works. I think I sort of do understand, still learning the Wordpress way tbh. But, this is my point, Wordpress has made it too difficult to accomplish some of the simple things.

thomastospace,
@thomastospace@phpc.social avatar

@outofcontrol It has to do mostly with history. It hasn't made things difficult to do. It made things possible that were originally different. Everything being a Post is one of them. It's absolutely great that if you make any post type, you can still publish it at a certain date, have authors, categories, etc. without any effort.
The downside is that it's also a trap. You can stub your toe on those things, which funnily enough wouldn't have happened if WordPress didn't provide this.

outofcontrol,
@outofcontrol@phpc.social avatar

@thomastospace Good description, thank you. Yeah, I was thinking having 4 date fields would be nice in WP (you can see my background showing) post_date, update_date, delete_date (soft-deletes), expire_date. But in core, not as meta fields. And yes, I am doing that “oh, the other framework is better because of a,b and c.” 🤪

The biggest downside I've hit with the current post_date thing, is not being able to use the standard query loop, and then needing to reinvent so much to get a page to work.

thomastospace,
@thomastospace@phpc.social avatar

@outofcontrol Did you check this?

https://www.advancedcustomfields.com/resources/order-posts-by-custom-fields/

I don't think that's too much reinventing.

outofcontrol,
@outofcontrol@phpc.social avatar

@thomastospace The problem we hit with this method was not being able to layout that page in a standard query loop using blocks. Instead, the designer would need to get into PHP to design the layout there, correct?

thomastospace,
@thomastospace@phpc.social avatar

@outofcontrol Yeah, this would need to be part of the theme.

Unless there's something for this in the advanced section of the Query Loop block.

But yeah. We always designed themes with Timber (Twig templates for Wordpress) + PHP.

The block builder was only used for the client to create posts, pages, etc.
Not for full designs.

outofcontrol,
@outofcontrol@phpc.social avatar

@thomastospace With a barebones WP the blocks are a definite improvement. Our latest site in progress is WP, 2024 as a starter Gutenberg blocks, no third party themes. Having Twig in WP seems like a really good thing too.

outofcontrol,
@outofcontrol@phpc.social avatar

@thomastospace It would be super awesome, if in this Block settings for the page, there was a “Show future posts only” switch:

  • All
  • Subscribed
  • Moderated
  • Favorites
  • wordpress
  • ngwrru68w68
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • megavids
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • provamag3
  • JUstTest
  • All magazines