Today I learned… how to customize the “Category” view in WordPress (Genesis framework) to show just the post titles as ordinary links in a list.
I really like the way posts of a category are displayed on DailyBlogTips. Each post gets a bullet in a simple unordered list.
By default, WordPress (and Genesis) gives you two options for displaying posts by category: either their full form one after another (do not want), or a truncated version with the post title and excerpt (also do not want).
A solution in which the titles were rendered as <a hrefs> between <li></li> tags required modifying the loop when on a Category page.
Please note that this code requires a theme built on the Genesis framework, though it should not be hard to modify the hooks to suit your framework if you know your way around a bit.
Copy the contents of functions.php into your child theme’s functions.php file.
Here’s what this is doing, in English:
When the current page is ‘Categories’ (Line 9), don’t do the usual genesis_loop (Line 13). Instead, do this custom loop (Line 14) called mjg_custom_loop.
Over in mjg_custom_loop, create a new unordered list (Line 21) and for each post (Line 22), echo its permalink and its name into a set of <li> </li> tags (Line 24).
The contents of style.css will probably need to be customized to fit your site’s design, but hopefully this is enough to get you through the hardest part which is customizing the loop on the category page.
Here is how it looks on the site:
10 thoughts on “WordPress Genesis Framework – Showing a List of Post Titles in Category View”
Thanks for this great tips,
Is there any tips if i want to display thumbnail images on list of posts titles in categories archieve?
this doesn’t work for me. I can sort of see what’s wrong but not quite.
yeah- figured it out. You only posted half the code needed to make it work. Nice.
Thanks for letting me know! Can you reply with what’s missing?
This helped, thanks! Haven’t used this kind of code for a couple of years so nice to find one to do this on a current project.
I couldn’t get the .category-post-title-list CSS to work — although I ended up putting my own cat-page-post class with the LI tag, and updating the CSS for that class… that worked fine.
This worked for me…thanks.. Any suggestions on how to get this to work on the main blog page as well? I would really like my main blog page to look the same with all posts listed like this.
Is it possible to provide the code to do this for all blog posts on the blog page?
Only a list of 5 items is shown. How can you show all posts in the category?
Total Thank’s for this solution!!…
This is perfect and exactly what I wanted. Now how can I do the same for tag archives and search archives? Is there a way to do it? so when someone hits a tag it shows same as category – a list of posts. When they search for something – same thing a list of posts nothing more.