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:
- Create an Archive Page in WordPress (Wirte, Pages).
- Choose the Archive page template.
- Add the code below to your custom_functions.php.
- 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&amp;title_li='); ?>
</ul>
</div>
<div class="archiver">
<h3>By Post: (Last 100 articles)</h3>
<ul>
<?php wp_get_archives('type=postbypost&amp;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%;}
Thank you for this. Made it much easier.
Hi Frank,
This was exceptionally helpful. Thank you.
Wish you well,
Alec
[...] Thesis custom archive page (tags: thesis thesiswp wordpress custom archive pages howto tutorial) [...]
Thanks for the help, I was looking for something like this!
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.
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.