query_posts(); not working at all
-
hello,
for some mysterious reason, i can’t use the query_posts() at all on my new blog. i was used to use it, and quite fan of it.
could it be because for the first time i used sandbox (created a theme based on sandbox?)
this is what i tried in archive.php :
<?php query_posts($query_string.'&order=ASC'); ?> <?php if (have_posts()) : ?>
as it didnot work out, i tried with :
<? $order='ASC'; $myquery = new WP_Query("order=$order"); ?> <?php if($myquery->have_posts()) : ?>
which is actually still written in tht page, but not working at all : posts are still displayed in descending order.
i created a template that i’m using within a page, and it works nice. the problem is with this code is i’m obliged to have all posts listed on a single page, because if i limit the number of posts (using LIMIT at the end of the query), i can’t navigate through pages ( can’t use the defautl function as
<?php posts_nav_link(); ?>
for instance.)would anybody have an idea?
thanks in advance,
<?php /* Template Name: Reverse */ ?> <?php get_header() ?> <div id="container" style="width:650px;"> <div id="content" > <?php //query_posts('orderby=date&order=ASC'); ?> <?php $querystr = " SELECT wposts.* FROM $wpdb->posts wposts WHERE wposts.post_status = 'publish' AND wposts.post_type = 'post' ORDER BY wposts.post_date ASC "; $pageposts = $wpdb->get_results($querystr, OBJECT); ?> <div id="nav-above" class="navigation"> <?php posts_nav_link(); ?> </div> <?php if ($pageposts): ?> <?php foreach ($pageposts as $post): ?> <?php setup_postdata($post); ?> <div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>"> <div class="entry-date" style="margin-bottom:5px"> <?php printf(__('%1$s %2$s', 'sandbox'), the_date('', '<b>', '</b><br /><br />', false), get_the_time()) ?> <?php edit_post_link(__('Edit', 'sandbox') ); ?> </div> <div style="margin-top:0; padding-top:0;" class="entry-content"> <?php the_content(''.__('Read More <span class="meta-nav">»</span>', 'sandbox').''); ?> <?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'sandbox') . '&after=</div>') ?> </div> <div class="entry-meta"> </div> </div> <!-- .post --> <?php //comments_template() ?> <?php endforeach; ?> <?php endif; ?>
kind regards, veronique
- The topic ‘query_posts(); not working at all’ is closed to new replies.