Thesis custom archive page

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=nametitle_li='); ?>
  </ul>

</div>

<div class="archiver">

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

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%;}

m

Leave a comment

6 Comments.

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

  2. Hi Frank,

    This was exceptionally helpful. Thank you.

    Wish you well,
    Alec

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

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

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


[ Ctrl + Enter ]

Trackbacks and Pingbacks: