Creating an Archive Index
-
I am trying to create an archive index which will display post by post and the corresponding date for each post.
I used wp_get_archives, and used a page template.
However, there seems to be no option to display the date before the post title and I also want “next”, “previous” and paging buttons.
I also tried placing a loop in the page template but it won’t display posts. It will only display the current page.
I want to create something like this: http://www.inquirer.net/specialfeatures/nbndeal/archive.php
Thanks!
-
Hi.
When you go to your setting in the admin, how many posts do you have set to view per page? if it is set to only 1 post per page, your archive will only show 1 post per page. May want to change that to 10. Also, running the loop WILL show as many posts, excerpt or whatever else youd like. Use this as a guide :
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <?php the_time('F jS, Y'); ?> <?php the_excerpt(); ?> <?php endwhile; else: ?> <?php _e('Sorry, no posts matched your criteria.'); ?> <?php endif; ?>Thanks for the reply Kozine.
My setting is set to display 10 posts. However it displays only one post (the current page im in). I think it is because the page is not the home page, (I am not using it as a static front page). So the loop will naturally display the current page.
What I did was use query posts to display the posts. It worked fine.
However, I still do not have “next” and “previous” buttons. Like what is displayed here: http://www.inquirer.net/specialfeatures/nbndeal/archive.php
Does anyone know how to put such within a query?
This is what I did:
<?php query_posts('showposts=15'); ?> <?php $posts = get_posts('numberposts=15'); foreach ($posts as $post) : start_wp(); ?> <li><?php the_time('m/j/y') ?> : <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?>This showed the past 15 posts.
Got an answer here: http://weblogtoolscollection.com/archives/2008/04/19/paging-and-custom-wordpress-loops/
via here: http://wordpress.org/support/topic/169554?replies=5
So I now got to have the list plus the page navigation.
One last thing, I need the page numbers in between the previous and more links.
For instance: <<Previous 1 2 3 4 5 6 More>>
The topic ‘Creating an Archive Index’ is closed to new replies.