Try this form of the loop for an oldest first post page; the difference from a “standard” WP loop is the <?php query_posts($query_string . '&orderby=date&order=ASC'); ?> line:
<?php get_header(); ?>
(html stuff)
<?php query_posts($query_string . '&orderby=date&order=ASC'); ?>
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>"> (etc, more html)
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
(html stuff)
<?php endif; ?>
Should work, but there might be other loop stuff that conflicts, depending on your theme.
Thread Starter
foxeye
(@foxeye)
can’t get it to work still. What piece of the template do i need to alter? this is the code:
<?php
// page id 21 will get category ID 12 posts, page 16 will get category 32 posts, page 28 will get category 17 posts
if (is_page('111') ) {
$cat = array(1);
} elseif ( is_page('54') ) {
$cat = array(6);
} elseif ( is_page('28') ) {
$cat = array(17);
} else {
$cat = '';
}
$showposts = -1; // -1 shows all posts
$do_not_show_stickies = 1; // 0 to show stickies
$args=array(
'category__in' => $cat,
'showposts' => $showposts,
'caller_get_posts' => $do_not_show_stickies
);
$my_query = new WP_Query($args);
?>
<h1><?php the_title(); ?></h1>
<div class="clearfix"></div>
<?php if( $my_query->have_posts() ) : ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php
//necessary to show the tags
global $wp_query;
$wp_query->in_the_loop = true;
?>
<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>