Yesterday I talked about how to increase blog traffic -- specifically how we increased All Freelance Writing's traffic by 80% in less than a year. One of the things that had a big impact for us was reformatting our category archive pages.
Rather than making people browse through page after page of posts (they never do get to the really old gems that way it seems), they can see a list of just the post titles -- all post titles for a category on one page. As I mentioned in that post, that change led to around a 10% increase in traffic when we implemented it, despite having fewer visits to category pages. People were visiting more actual posts, which is what we really want as bloggers anyway.
A reader wanted to know how to make that change. So I promised to post my code. And here it is. This is the code I used to format our category pages the way they are now. This code was added to the archive.php template file:
<div style="margin-left: 40px;"><?php /* If this is a category archive */ if (is_category()) $description=category_description(); echo $description; ?></div><?php while (have_posts()) : the_post(); ?><div style="margin-left:50px;"><ul><li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li></ul></div><?php endwhile; ?>
Now I tossed some CSS formatting in there in my case because the alignment was off with the rest of our design. You can remove that or alter it to suit your own design needs. Here's what the code looks like with that removed:
<?php /* If this is a category archive */ if (is_category()) $description=category_description(); echo $description; ?><?php while (have_posts()) : the_post(); ?><ul><li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li></ul><?php endwhile; ?>
Please remember that if you copy / paste this code from the site directly you might not get plain-text quotes. So you might have to retype them manually in your plain-text editor or template file.
Now I don't claim that this is the "right" way to do it or the "best" way to do it. But if quick and dirty gets the job done, it works for me (within reason). And in this case, it just worked.
I make no promises that this code won't royally f*ck up your blog. As always, before you make any changes back up your original archive.php file so if there's a problem you can quickly put it back the way it was. I take no responsibility if it doesn't play nice with your particular theme. If you already have special category page formatting in there, you might just be able to alter that a bit to get what you want. Some themes even have a separate category.php template which is a bit of a different beast. So use this information at your own risk. (Oh, and it's only for WordPress.org blogs -- I do not know if you have access to these template files on WordPress.com blogs.)
- 30 Queries in 30 Days – Freelance Writing Challenge - June 23, 2020
- 30 Blog Posts in 30 Days Blogging Challenge - June 22, 2020
- Reader Question: How Can My Freelance Writing Business Survive the Coronavirus Pandemic? - April 3, 2020