Ascending Code Not Working in My Template
-
I have created a template page that lists all post titles in a specific category.
My page code works great but I couldn’t reorder it in date-ascending order.
I changed this:
<?php if (have_posts()) : ?>
to
<?php query_posts($query_string . '&order=ASC'); if (have_posts()) : ?>
But it didnt work.
My template code is here:
<div id="content" class="section"> <?php // page id 714 will get category ID 11 posts, page 718 will get category 3 posts if (is_page('714') ) { $cat = array(11); } elseif ( is_page('718') ) { $cat = array(3); } 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); ?> <?php if( $my_query->have_posts() ) : ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4> </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Ascending Code Not Working in My Template’ is closed to new replies.