What is this? From this page you can use the Social Web links to save Quickly Add Archive Totals to Your WordPress Theme to a social bookmarking site, or the E-mail form to send a link via e-mail.

Social Web

E-mail

E-mail It
July 02, 2007

Quickly Add Archive Totals to Your WordPress Theme

Posted in: How-To & Tech Tips

Note: Despite last week’s vote regarding the value of the “by-month-archive’ section, I decided to go ahead and publish the following post (mostly because it was already written). Complete vote results and analysis will appear on TechTraction this Wednesday 7/4/07. Thanks for stopping by.

On Monday (6/25/07) I posted a short article describing how to add category totals to the category list displayed in your WordPress theme’s sidebar. Adding these totals was easy and a real benefit, in my opinion, for your site’s visitors. You can also add an archive total (assuming you are displaying a standard archive list in your sidebar) in much the same way. And while visitors might not find this total useful, it can help you, the site owner, get a quick overview of how you have been doing with site content from one month to the next.

Adding “show_count” to “wp_get_archives” to Display Archives Totals in the Sidebar

I’ve struggled lately with posting content to TechTraction on a regular basis. While I have no shortage of topics to post about, my day job keeps getting in the way. I’ve been working at ways to overcome this posting problem and one thing I’ve decided I needed is a quick overview of my content totals from one month to the next. Taking off on the category total idea, I decided to add an archive total to my sidebar. If that sounds like something you want to do, follow these simple instructions:

  1. Log into your WordPress powered site as admin
  2. Select Presentation from the menu bar
  3. Select Theme Editor from the Presentation sub menu
  4. Locate and select the sidebar.php file from the “theme files” listing on the right hand side of the screen
  5. Scroll through this file and locate wp_get_archives(‘type=monthly’). The parenthetical option “type” allows you specify the type of archive you want to display. Options include postbypost, daily, weekly, monthly (the default), and yearly. Most WordPress themes display monthly archives in the sidebar. To learn more about the wp_get_archives tag refer to the WordPress reference page on the topic.
  6. Follow the “type=monthly” setting, if one is present, with “show_count=1″ and join them together with an ampersand. The completed edits will leave you with one of the following two lines:
  • wp_get_archives(‘type=monthly&show_count=1′)

or

  • wp_get_archives(’show_count=1′)
  1. Press the Update File button to save your changes
  2. View your site to review and confirm your changes

Similar to Monday’s post (6/25/07) outlining how to add category totals to your sidebar, adding archive totals is just as quick and easy. Site visitors might not care how many posts exist in a particular month; however, if you want to easily monitor your month-to-month posting consistency, then add an archive total to your sidebar’s archive list.

For more information about WordPress template tags, take a look at the developer documentation back at the WordPress.org web site.


Return to: Quickly Add Archive Totals to Your WordPress Theme