Creator Theme Feature Fest starts January 22nd
Today I’m sharing a WordPress custom page template that will allow you to list all your posts by category.
While I’m usually focusing on creating highly visual indices for my clients, that isn’t always the case. While this page template can be altered to display additional information, it currently has a very simplified output: category name followed by linked post titles to all content in that category.
This will create an automatic index by all of your categories – additional edits will need to be made in order to exclude any categories.
Indices set up in this manner are great for highly informative blogs, where the viewers are coming with specific questions in mind: making it easy for them to find this information is goal number one.
I’m a firm believer in “work smarter, not harder” and try to re-use code… provided it’s the best answer I can find. In this case, what kept coming up for me was plugins (I avoid these when possible) or code snippets that I knew were not recommended (altering the main query). The best-fitting solution, for me, was to create a custom page template.
Grab the code below, paste into a new file called ‘page_category_index.php’ and upload it into your theme files. Now create a new page and choose “category index” for the template. Your information will, from now on, automatically populate, leaving you worry free!
https://gist.github.com/graylaurenm/aa9dade36cf61de24fd2
pssst.. Check out our sister brands!
Leave a Reply