Enter your keyword

How To Make A Static Archives Page For The Thesis Theme

How To Make A Static Archives Page For The Thesis Theme

A static page that lists archives by category and by date is very useful.

A static page that lists archives by category and by date is very useful.

One limitation of the Thesis Theme for WordPress is that it doesn’t come with a page listing category archives made for you all neat and easy, straight out of the box. Fortunately, though, this is easily remedied. Though I had been using the Clean Archives Reloaded plugin for WordPress to generate a static archive page, I found a tutorial to generate a more full-featured archives page for use with Thesis. Theoretically, you could use this tutorial in any WordPress blog, but the instructions I’m going to put here will be specifically for use with Thesis.

To generate your archives page, you will first need to create a page on which the archives will appear. Go to the WordPress dashboard and create a new page, noting both the name of the page (archives is a good choice) and its post/page number (usually, if you hover over the page name in the list of pages, you can see the number in the lower left-hand corner of your browser). You will need that information later.

Next, go to your custom_functions.php file and add the following code (you cannot use Thesis Open Hook here because this is a conditional function that will only be working on one page):


function add_category_archives() {
if (is_page('archives') || is_page('247')) {
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts('category_name=Featured&showposts=' . $limit . '&paged=' . $paged);
echo '

';
thesis_home_loop();
echo '

' . "\n" . '

';}
}

remove_action('thesis_hook_custom_template','thesis_custom_template_sample');
add_action('thesis_hook_custom_template', 'add_category_archives');

You will need to sub in your own page name and page number in the second line of that code, keeping all of the other punctuation exactly the same. Using both the page name and the page number is not technically essential for this function to work, but it does make it easier to ensure that everything still works if you ever change permalink structure, etc. After plugging all of that in, make sure the page you created is published, and check out your new archives. Please note: this code works for installs within the main folder of your site only. Other installs will require some additional coding, which I will cover in a later post. In the meantime, check out this tutorial for a similar means of creating an archive page.

Comments (5)

  1. help me
    Oct 16, 2009

    I did what you said and added the the code in my custom funtions.php… but nothing is happening it still shows a blank page..

  2. Oct 16, 2009

    Are you absolutely sure that all of the page names, and page numbers are correct for your site? The page number, for example, will be different.

    Also, if you have your wordpress install in a different folder, it’s possible that it won’t work.

  3. Oct 16, 2009

    If you post the code you used here, I can help you better!

  4. Dec 4, 2009

    I assume that your own “Archives” page is using this technique and I like it. Unfortunately, your code is not working for me either. I created a new page, “Archives” I copy and pasted the code into my custom_functions.php folder and changed the page number in the second line.

    If I use the use the Thesis “archive” template, I get the conventional archive page. If I swich to “default template” or “no sidebars”, I get nothing on the Archives page except the title, “Archives”.

  5. Dec 4, 2009

    Hi Rick

    I think it has something to do with where the wordpress install is located in relationship to the rest of the site. For example, my main blog is installed at abdpbt.com. The archive code works fine there, but in the subblogs it does not. I’m working on figuring out why this is. In the meantime, check out this tutorial

    http://mattflies.com/tech/10-ways-to-customize-thesis-and-enhance-your-blog/

    For a slightly less buggy (I think) version. This code works so perfectly on my main archives, I didn’t realize it caused so many problems elsewhere. Sorry about that!

Post a Comment

Your email address will not be published.