I’m learning new things all the time, and like to share. I’ve encountered some issues with the blog template I created, so I’ve been sorting them out. I was going to just edit my previous template post, but I thought about it and decided that my followup work deserved its own post, mainly because I was just going to confuse myself along the way.
The big issue I discovered with my template was that the pagination wasn’t working. Very very sad face–because, after all, if you have more posts than will show on one page, obviously you might want to be able to continue on to the second page, or the third.
So, here is the new and improved custom blog template code:
Note that it’s calling a featured image “portfolio” … if your functions file doesn’t create an image size called portfolio, you’ll want to pick a different thumbnail size there. Additionally, I’ve added a conditional so that the content of the blog page itself shows only on page one, not on subsequent pages.
You May Also Like:
For styling, I wanted to come up with a way to use the template whether it was a full width layout or a more standard blog layout with a sidebar. Once I realized that they each had their own body class, it was easy. The smaller width has two columns of images; the larger has three.
You can still use a query_args custom field with this to pull a certain category or change the number of posts per page. Again, this is live in action on my web design services page here on my website. Enjoy!