Creating custom archive pages
Let's create custom archive pages. Now if we click on one of the categories, it'll take us to a category archive.
If we click on admin, the username, it will take us to the author archive. There are others as well. We can also have archives by dates, we can have them by tags, and so on. So let's go into our themes
folder. We will create a new file and save that as archive.php
and open that up.
Now if we go back and click on a category, you can see it's blank because it's looking at the archive.php
page. We will copy what's in the index.php
page and paste that in archive.php
.
I want these pages to be much more simple. We don't need the meta, and we don't need the image; pretty much just the title and the date is all that we want. So let's go to where we have the <article>
tag and get rid of the whole part.
We will replace this with a <div>
tag and give it a archive-post
class. We'll enter <h4>
; then we'll insert a link, which will go to the_permalink...