WordPress Genesis Framework – Showing a List of Post Titles in Category View

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.

posts_as_list_items
DailyBlogTips’s category view shows just the post titles in an 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:

category_links_only
Titles-only Category view on TowerSecrets.com

10 thoughts on “WordPress Genesis Framework – Showing a List of Post Titles in Category View”

  1. Thanks for this great tips,
    Is there any tips if i want to display thumbnail images on list of posts titles in categories archieve?

    Thanks
    Billy

  2. 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.

  3. 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.

  4. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.