Site logo

Archived topic

Show latest posts on 404 page with php

4 replies · Started by René on February 7, 2023

Viewing posts 1–5 of 5

Hello,
how can I edit the content-404.php to show the most recent posts after the search bar? In the same style as on the archive pages. Is there maybe a shortcode or method i can use?

Code

Hi there,

why not just use a GP Block Element, to create your own 404 template, and then use a GB Query Block or the Core Latest posts block to display the posts ?

Otherwise you will need to create a custom loop in PHP.

Let me know

Glad to hear you found something you can use.

Your alternative would be to look at the themes archive.php and use that as a basis for your child theme 404 template. As that already has a loop for you to work with.

This archived topic is closed to new replies.