• I’ve been working on a sub site for a podcast where I want to use the “wp_get_archives” tag to pull a page together with the last 100 posts, in order.

    Got this:

    <?php wp_get_archives(
    'type=postbypost
    &limit=100
    &format=custom
    &before=<br />
    &after=<br />');
    ?>

    It works great, but I’d really like to add a second line showing the date, like this:

    <?php wp_get_archives(
    'type=postbypost
    &limit=100
    &format=custom
    &before=<br />
    &after=<?php the_date(); ?><br />');
    ?>

    As you know, adding php in a string like this doesn’t quite work.

    How can I add a second line featuring the post date of each title from the archives?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can use query_posts to make your own loop, instead of using wp_get_archives.

    Yes, it’s more work; but you get the full contents of each archive post this way, to do with as you see fit.

    Thread Starter dss

    (@dss)

    hmm…

    After reading several more pages and a few links, I tried this:


    <?php query_posts('orderby=date'); ?>

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <div class="post">

    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <small><?php the_time('F jS, Y'); ?></small>
    </div>

    <?php endwhile; else: ?>

    <p>Sorry, no posts matched your criteria.</p>

    <?php endif; ?>
    </div>

    But it breaks…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Archives by title (with date)’ is closed to new replies.