Support » Themes and Templates » Display all post titles (period) on the Archives page

  • I want the archives page to display every post title I’ve ever written in reverse chronological order. Not by category, not by date. Just one long list of every post title, each one permalinked, of course.

    I know how to alter the template to display titles and links. What I don’t know how to do is change the query. It’s currently returning every page title, presumably because is_page is true.

    Can you help?

Viewing 1 replies (of 1 total)
  • Got it.

    global $wpdb;
    $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date DESC");?>
    <?php if (have_posts()) : ?>

    <?php foreach($posts as $post) :
    setup_postdata($post); ?>

    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> <small><?php the_time('l, F jS, Y') ?></small></li>
    <?php endforeach; ?>
    <?php endif; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Display all post titles (period) on the Archives page’ is closed to new replies.