Typography is the craft of endowing human language with a durable visual form, and thus with an independent existence. (...) Typography remains a source of true delight, true knowledge, true surprise.

Robert Bringhurst, The Elements of Typographic Style

By Frank, on November 16, 2008

WordPress

Tags:


Thanks to a new hook in Thesis 1.3.2 you can easily change the look and feel of your archives page. There are basically four steps to creating your custom archives page:

  1. Create an Archive Page in WordPress (Wirte, Pages).
  2. Choose the Archive page template.
  3. Add the code below to your custom_functions.php.
  4. Add code to your custom.css to style the archives page (sample provided below).

PHP code for custom_functions.php

function my_archive() {
?>
<div class="archive">
<div class="archivel">
  <h3>By Month:</h3>
  <ul>
    <?php wp_get_archives('type=monthly'); ?>
  </ul>

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

</div>

<div class="archiver">

   <h3>By Post: (Last 100 articles)</h3>
   <ul>
     <?php wp_get_archives('type=postbypost&limit=100'); ?>
   </ul>
</div>
</div>
<?php
}

remove_action('thesis_hook_archives_template', 'thesis_archives_template');
add_action('thesis_hook_archives_template', 'my_archive');

Depending on how your custom_functions.php is setup you may need beginning/ending PHP tags in this code.

Sample code for custom.css

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


6 Comments to “Thesis custom archive page”

  1. J Warner says:

    Thank you for this. Made it much easier. :-D

  2. Alec Satin says:

    Hi Frank,

    This was exceptionally helpful. Thank you.

    Wish you well,
    Alec

  3. [...] Thesis custom archive page (tags: thesis thesiswp wordpress custom archive pages howto tutorial) [...]

  4. Ana says:

    Thanks for the help, I was looking for something like this! :-)

  5. Hi,

    thanks for this. I originally had an archive and sitemap page and did not like the format. After reading this post, I changed mine and now I’m happy :)

    Thanks for sharing this.

  6. Andrea says:

    I’ve tried this several times and every time I edit my custom_functions file, I get an error message and my website becomes unusable. So, I have to back up the file via FTP. I there a certain place within the custom_functions file I must add this? Everytime I try to edit anything within the custom functions I always get an error.

Leave a Reply