custom post types and archives

custom post types and archives

This is a follow up to my post about the Genesis blog template, because that template was a serious part of the solution for me. What happened here was that Rabia Gale, who also happens to be my sister-in-law, decided to serialize Quartz, one of her novels, on her website. Super fun project! She asked how she could do that without it getting swirled into the mix of her regular blog and wondered if she needed to set up a second site to handle it, so that she could have separate sidebars and information. Somehow it seemed like extra work to me to have an identical site with different content–she’d have to log into two different places, keep both installations updated, and it would be a hassle. I think. So I puzzled a bit and decided that surely we could set up a custom post type in WordPress for her, which would give her the separation, an option for custom sidebars, and a separate RSS feed.

Happily, Google led me first to Carrie Dils’ easy tutorial on how to set up sidebars for a custom post type. That was my first step and probably the easiest to get sorted. I knew I wanted the custom sidebars on both the individual episodes and on the novel’s archive page as well.

My next puzzle to solve, and the hardest, was to figure out how to handle the archive page. What I really wanted was a page that would not only show the episodes, but would also have at the top, a synopsis and/or instructions for how the serialization would work. I saw a recommendation for a plugin that would generate an archive page for me, but it absolutely did not work with my custom sidebars, no matter what I did. So I struggled with making a new archive page, messing with the loop, and honestly not succeeding.

Until inspiration struck, and I remembered the handy Genesis blog template and my preferred trick to have the content and the posts. It’s possible to use the blog template to pull not only a specific category, but to change it to pull a custom post type instead. In this case, my query_args custom field became “post_type=quartz” (the name of the post type). At this point, I was mostly done, since now I could set up a page to pull the custom post type as a blog feed, Rabia could put her synopsis at the top, and fill her Quartz-specific sidebars with whatever widgets she wanted–like a table of contents.
genesis blog template
The final trick was to hide the post info and meta fields on my new archive page, which I could not do with PHP since I was using the standard blog template (if I did modify that template, it would mean that Rabia couldn’t use it for other things, which would be unfortunate). This was easily done by adding a custom body class to the page and using some CSS to hide it.

I’ll confess, I wasted quite a bit of time sorting through this one, and my online searches for answers didn’t show this as an obvious solution (so either I’m alone in wanting to do this or it was more obvious than I thought). In case I’m not alone, I thought I’d share my experience so someone else can benefit.

I think you might also enjoy reading the novel! Go on, check out Quartz today! (Since today was the first episode, you won’t even be behind.)

Reader Interactions


  1. cdils says

    Hey Robin,
    Cool bit of customization for Rabia’s site. Thanks for sharing!

    You found a creative workaround for hiding post meta on the archive page. You could also do it programatically with a conditional statement.

    Something like:

    /** Remove the post meta function */
    remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

    /** Add the post meta function (conditionally) */
    add_action( 'genesis_after_post_content', 'custom_post_meta' );

    function custom_post_meta() {
    // If it's not your CPT page
    if !( 'yourCPTname' == get_post_type() ) {

    Note: I didn’t test that code, so beware. Just an idea. 🙂


    • Robin says

      Thanks, Carrie! I am pretty sure that hiding it with CSS is a bit of a shirk, but the meta and info here were a bit tangled up because her theme does have post formats in play as well. I made a few attempts within the functions file but decided this worked out for now.

      Thanks for stopping by!

  2. Martin Webster says

    Thanks for the pointers Robin and Carrie … it helped me work something out. Here’s the code I came up with:

    //* Custom post meta function
    add_action( 'genesis_post_meta', 'child_do_custom_post_meta' );
    function child_do_custom_post_meta() {
    if ( 'book' == get_post_type() ) {
    /* Custom code for 'book' post type. */
    } else {
    $post_meta = '[post_categories before="Filed Under: "] [post_tags before="Tagged: "]';
    return $post_meta;

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.