WordPress Post Archives Template Tag

The WordPress Post Archives template tag is a powerful way to display the blog post archives in a number of ways on your website. Using the <?php wp_get_archives(); ?> tag will achieve these results.


The parameters and values for the post archives template tag are shown in the table. Again, values that appear in bold are the default values set by WordPress. Here are just a few examples of what you can produce with this template tag:



  • Display the titles of the last 15 posts you’ve made to your blog.



  • Display the titles of the posts you’ve made in the past ten days.



  • Display a monthly list of archives.










































Most Common Parameters (Query-String) for class="code">wp_get_archives();
Parameter and TypePossible ValuesExample
type (string)

Determines the type of archive to display.
monthly; class="code">daily; weekly; class="code">postbypost<?php wp_get_archives(class="code">'type=postbypostclass="code">'); ?>

Displays the titles of the most recent blog posts.
format (string)

Formats the display of the links in the archive list.
html (surrounds links
with <li> class="code"></li> tags);class="code">option (places archive list in drop-down list
format); link (surrounds links with class="code"><link> </link> tags); custom (use
your own HTML tags with before and after parameters)
<?php wp_get_archives(class="code">'format=htmlclass="code">'); ?>

Displays the list of archive links in which each link is surrounded
by the <li> </li> HTML
tags.
limit (integer)

Limits the number of archives to display.
If no value, all display.<?php wp_get_archives(class="code">'limit=10class="code">'); ?>

Displays the last ten archives in a list.
before (string)

Places text or formatting before the link in the archive list when
using the custom parameter.
No default<?php wp_get_archives(class="code">'class="code">before=<strong>class="code">'); ?>

Inserts the <strong> HTML tag
before each link in the archive link list.
after (string)

Inserts text or formatting after the link in the archive list when
using the custom parameter.
No default<?php wp_get_archives(class="code">'class="code">after=</strong>class="code">'); ?>

Inserts the </strong> HTML tag
after each link in the archive link list.
show_post_count (Boolean)

Displays the number of posts in the archive. You’d use this
if you use the 'class="code">type' of class="code">monthly.
true class="code">or 1; class="code">false or 0<? wp_get_archives(class="code">'class="code">show_post_count=1class="code">'); ?>

Displays the number of posts in each archive after each archive
link.

Here are a couple examples of tags used to display blog post archives.


This tag displays a linked list of monthly archives (for example, January 2011, February 2011, and so on).


<?php wp_get_archives('type=monthly'); ?>

This tag displays a linked list of the 15 most recent blog posts:


<?php wp_get_archives('type=postbypost&limit=15'); ?>



dummies

Source:http://www.dummies.com/how-to/content/wordpress-post-archives-template-tag.html

1 comment: