Skip to content
scribu edited this page Jun 27, 2012 · 4 revisions

Using the shortcode

The plugin comes with a shortcode which you can insert in any post or page content:

[smart_archives]

To display only the block, you can do:

[smart_archives format=block]

Using the template tag

Besides the shortcode, there is also a template tag, which you can insert into your theme's template files:

<?php smart_archives(); ?>

The template tag takes two parameters:

<?php
$sar_args = array(
  'format' => 'fancy',
);

$query_args = array(
  'post_type' => 'portfolio'
);

smart_archives( $sar_args, $query_args );
?>

Specific parameters

$sar_args is an array of parameters specific to the plugin. Normally, these are set via the admin settings page, but you can overwrite them:

  • 'format': string; one of these: 'block' | 'list' | 'both' | 'fancy' | 'menu'
  • 'anchors': boolean
  • 'block_numeric': boolean
  • 'list_format': string
  • 'date_format': string
  • 'posts_per_month': integer

Query parameters

$query_args is an array of parameters that will be used to get the list of posts. All the parameters that WP_Query accepts are also accepted here.

Clone this wiki locally