So I have created an archive.php, set everything up, and my archive page works fine.
Now I was wondering, of how I should prevent the archive page from listing itself.
When accessing the page called archive for instance , without any date/category parameters set, the query of the archive page is itself, like on a normal page. So the WP Loop will of course check has_posts etc. and the list itself, but I want to add something like the latest posts if there are no "filters" applied.
Anyone got an idea?
So I have created an archive.php, set everything up, and my archive page works fine.
Now I was wondering, of how I should prevent the archive page from listing itself.
When accessing the page called archive for instance https://domain/archive, without any date/category parameters set, the query of the archive page is itself, like on a normal page. So the WP Loop will of course check has_posts etc. and the list itself, but I want to add something like the latest posts if there are no "filters" applied.
Anyone got an idea?
As @Milo told me in the comments, the problem lies in the fact, that the archive template shouldn't be applied to a page, but left untouched.
That way WordPress will still know which template to use for displaying an archive but you can't access the template itself, which means it will not display itself in the query.
archive.php
isn't a template you manually assign to a page, it's the template WordPress automatically uses when you set your page as the archive underSettings > Reading > Posts page
. – Milo Commented Jan 27, 2019 at 20:23