Question about #wordpress. I want a regular page with all my post (a stream) and a front page with just a selection (in my case any post NOT in Uncategorized category). Do I need to build a custom `front-page.php` or is there some other nice way to achieve this?
@metbril You could probably use a `pre_get_posts` callback (which accepts a `$query` arg) or something and then check for either `is_home()` or `is_front_page()` (not too sure) and `$query->is_main_query()` and then modify `$query` accordingly. Or use a custom query in a `front-page.php` template. 🤓 https://developer.wordpress.org/reference/hooks/pre_get_posts/#basic-examples
@jan That pre_get_posts callback could be in my functions.php, I guess, so no need to change or clone any template file?
@metbril Exactly. First of those basic examples on that page would probably work, just need to change the `post__not_in` bit with `category__not_in` and the correct category ID (or slug, not sure).
@metbril You could (probably) do the same for your “stream” page, by the way, even include CPTs, or remove the post limit (in order to really get all of them instead of paginated results). Instead of `is_front_page()` you would then do `is_page( 'page_ID_or_slug' )` or something.
@jan I'm new to this, so it's a little trial and error. The (sempress) theme has an index.php, no home.php or front-page.php. I've set my home page to a static page and the blog page "/all" to another. The blog page shows the stream just fine (regular WP) but the new home page still shows the regular content (title et al).
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!