• Andrew

    (@andrewkantor)


    Hey, all.

    On the front page of my site, I display one day’s entries. But I also want to have links to the two previous days’ posts.

    Problem: I get two links to appear, but one is always for the current day. So on Wednesday, I *want* to have links to Tuesday’s and Monday’s archive pages, but I end up with links to Wednesday’s and Tuesday’s.

    Here’s the code I use:

    <?php wp_get_archives('type=daily&limit=2&offset=1'); ?>

    I realize that offset doesn’t work with wp_get_archives. Is there something that will work?

    Many thanks for any suggestions!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Andrew

    (@andrewkantor)

    Whoops — I should have said I was using get_archives, not wp_get_archives. But the question is the same.

    Offset would be a great option for wp_get_archives !

    Since I’ve also plunked around looking for a way to this, I thought I’d share my solution… I just used query_posts and a loop inside my sidebar to list posts with an offset, and styled them into a list:

    /* Shows up to 20 posts, excluding the first 6 */
    <?php if ( have_posts() ) : query_posts('showposts=20&offset=6'); while ( have_posts() ) : the_post(); ?>
    
    /* Style this to suit your own theme */
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to offset display of archives?’ is closed to new replies.