Ready to get started?Download WordPress


Generic Archive Link (4 posts)

  1. Tom Belknap
    Posted 4 years ago #

    I'm wondering if there is some way - heretofore missed in my travels - of creating a generic link to "archives?" What I mean is: I know I could easily link to the August, 2009 archives (/blog/2009/08), but I'd like to be able to create a link which automatically goes to the latest monthly archive (or weekly, for that matter) and updates consistently.

    My front page does not contain a standard list of posts like the basic format would be. It only shows the most current sticky post. Thus I'd like to be able to send someone to a "See more posts" page, but the standard wp_next_posts() function is not working. I am surprised to find that this links to another page generated using home.php instead of what I expected, which was index.php or even archives.php. But then, I guess this is another question altogether!

  2. esmi
    Forum Moderator
    Posted 4 years ago #

  3. Tom Belknap
    Posted 4 years ago #

    Thanks esmi. Problem is, this function inexplicably seems to "return" the HTML list rather than an array as one might expect:

    $archives = wp_get_archives('type=monthly&echo=0');
    ?><!-- <?php print_r($archives); ?> -->


    <!-- 	<li><a href='http://holisticnetworking.net/blog/2009/08/' title='August 2009'>August 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2009/07/' title='July 2009'>July 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2009/06/' title='June 2009'>June 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2009/05/' title='May 2009'>May 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2009/04/' title='April 2009'>April 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2009/03/' title='March 2009'>March 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2009/02/' title='February 2009'>February 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2009/01/' title='January 2009'>January 2009</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2008/09/' title='September 2008'>September 2008</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2008/07/' title='July 2008'>July 2008</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2008/06/' title='June 2008'>June 2008</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2008/04/' title='April 2008'>April 2008</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2008/01/' title='January 2008'>January 2008</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/12/' title='December 2007'>December 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/11/' title='November 2007'>November 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/10/' title='October 2007'>October 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/09/' title='September 2007'>September 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/08/' title='August 2007'>August 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/07/' title='July 2007'>July 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/04/' title='April 2007'>April 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/03/' title='March 2007'>March 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/02/' title='February 2007'>February 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2007/01/' title='January 2007'>January 2007</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2006/08/' title='August 2006'>August 2006</a></li>
    	<li><a href='http://holisticnetworking.net/blog/2006/07/' title='July 2006'>July 2006</a></li>
  4. esmi
    Forum Moderator
    Posted 4 years ago #

    Unfortunately, there aren't many options to grab an array of archives. You could do an explode() to turn the string into an array.

Topic Closed

This topic has been closed to new replies.

About this Topic