Jazz Up Your Archives Page



13 Sep 09

You can stick with the standard Archive page that comes with Thesis or you can add some spice.

If you would like to give your readers the option of viewing your category and month archives, plus your last 50 posts and your tags - then use the code that follows.

  • Remember to first create a page using the ‘Archive’ template in the drop-down box in ‘new post’ mode.

If you want to show more or less tags

  • Change the number from ‘0′ (zero) which is unlimited and will show all, to a specific number.

If you want to show more or less posts

  • Change the number from ‘50′ to whatever you like.
  • Remember to change the text between the <h3> tags, e.g. “…Last 50 articles…”

Copy and paste this code into your custom_functions.php file

function my_archive() {
?>
<div>
<div>
 <h3>By Category:</h3>
 <ul>
 <?php wp_list_categories('sort_column=name&title_li='); ?>
 </ul>

 <h3>By Month:</h3>
 <ul>
 <?php wp_get_archives('type=monthly'); ?>
 </ul>
 <h3>By Tag:</h3>
 <ul>
 <?php wp_tag_cloud('number=0')?>
 </ul> 

</div>

<div>

 <h3>By Post: (Last 50 articles)</h3>
 <ul>
 <?php wp_get_archives('type=postbypost&limit=50'); ?>
 </ul>
</div>
</div>
<?php
}
remove_action('thesis_hook_archives_template', 'thesis_archives_template');
add_action('thesis_hook_archives_template', 'my_archive');

Copy and paste this code into your custom.css file

/*-----archives-----*/
.custom .archive h3 {margin-top: 0;}
.custom .archive ul {font-size: .85em; }
.custom .archivel { float: left; width: 40%;}
.custom .archiver { float: right; width: 60%;}

You should now see something like this:

Archives jazzed up

Code adapted from Matt Flies and enhanced after visiting WordPress Codex.

Related Posts

  1. Marketing Tip: Add Your Logo Before Each Headline
  2. Making Changes to the Thesis Navigation Menu
  3. Tutorial: Customizing Thesis – Standard to Unique in 6 Easy Steps
  4. Free HTML and CSS for a Table Within a Post or Page
  5. Thesis Teasers Give You That Magazine Feeling

{ 15 comments… read them below or add one }

should I October 17, 2009 at 4:05 am

what should I put in the robots.txt regarding this page? (archive)
and should I nofollow it?
I’m afraid that I’ll be penalized by google.

Reply

Somone Bull October 18, 2009 at 10:14 am

Anything done with good intentions shouldn’t be penalised by Google. Think of what ‘normal’ html webistes do with their code and how different blog sites are. If it is a standard function of WordPress or an option in coding and 99% of all actions on your site (e.g. article content) is done with good intention, how is Google going to identify an advantageous decision. A lot of people are putting the fear of God into people about SEO ‘tactics’ when they are just design options often built into many themes. At the end of the day just do what you are comfortable with without worrying about scare tactics by others. My opinion only. :-)

Reply

liewzy October 21, 2009 at 7:13 pm

Am I wrong? I think you missed out the .
liewzy´s last blog ..LiewZY: @P1W1MAX Nevermind :) My ComLuv Profile

Reply

liewzy October 21, 2009 at 7:15 pm

I mean div class name

Reply

Somone Bull October 22, 2009 at 7:18 pm

The code works fine on my sites without changes.

Reply

TechChunks January 12, 2010 at 1:28 am

Just curious. Is there a version that may work on a Non-Thesis theme? Sorry if I’m asking for too much :)
TechChunks´s last blog ..TechChunks is Google Page Rank 2 Now and Wishes You A Happy New Year 2010 My ComLuv Profile

Reply

Somone Bull January 12, 2010 at 6:04 pm

I’d say it would as all the php code relies on standard WordPress calls. There’s nothing unique about it to tailor it to Thesis. Give it a run and let me know how you go.

Reply

Smart Blogs January 23, 2010 at 7:33 pm

Hi I want to ask why in my thesis theme archive can’t same like your preview
this is my archive please give me some tutorial, thank you
Smart Blogs´s last blog ..Lenovo IdeaPad G550-NTD9AFR Dual Core and Windows 7 Review My ComLuv Profile

Reply

Mathdelane January 25, 2010 at 11:27 am

Hi Somone,
This is a great tutorial as usual and I have incorporated this on my blog however as I merely copy-pasted the codes, how do I make it the same as the screen shot above wherein the last 50 articles are in parallel columns with the categories?
Mathdelane´s last blog ..Can’t Open Yahoo Mails? My ComLuv Profile

Reply

Somone Bull January 25, 2010 at 5:49 pm

I just realised I had deleted my css for archives the last time I revamped the site and only had the one column like your archives have at the moment. I just added the css to my custom style sheet (as it is above) and it worked a charm – back to 2 columns. I notice that my column is wider. Perhaps if you try making your archives ‘page’ template no sidebars for a moment to see if it accommodates two columns if it is wider.

Otherwise, I would check your php as it appears in your custom-functions.php file to make sure you didn’t lose anything with copy and paste. I usually paste into a text editor like notepad before I paste into my site’s code sheets.

See how it goes.

Reply

Mathdelane January 26, 2010 at 4:33 am

Hi Somone,
Thanks for the response. I’ve tried what you suggested but apparently switching the template to “no sidebars” made the contents (links) disappear.
Mathdelane´s last blog ..Working with Google Translate Client for Windows My ComLuv Profile

Reply

Shannon May 16, 2010 at 5:41 am

Thanks for this tutorial. To get the styling to work, I had to assign classes to the divs in the php code and it worked fine then.

Reply

Arun Basil Lal July 14, 2010 at 10:34 pm

Thanks for this, worked perfectly :)

Reply

Kang Asep July 15, 2010 at 2:59 am

Hai, thank you for your turorial, i’ve use it at my blog, I also included your tutorial into my blog, I hope you do not mind

regards,

asep

Reply

Greg July 25, 2010 at 9:56 am

Hi Somone
Great tutorial.I was having a lot of problems with my archives page
I deled my old page,created a new one,pasted your codes and presto it works a treat

I have only experienced disaster playing around with the custom_functions.php files.
Your code has made a person happy
Regards
Greg

Reply

Leave a Comment

Previous post:

Next post: