Fixing a problem with query_posts
-
I’m using the popular free template JournalCrunch, which is working wonderfully in all aspects except one: it appears to use query_posts in an unorthodox/incorrect way, so that my home page always displays the x most recent posts but does not properly allow for pagination.
After googling for help, I found this article which seems to spell out exactly why it’s not working (http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html); however I lack the PHP experience to know how to mod this template to work correctly. Below, I’ve included the relevant code from my template; can anyone suggest the best way to replace it with a rewritten version that allows me to use pagination properly? (Note that I really don’t know PHP, so I can’t figure out what the code below is doing, so that’s why I don’t know how to mod it.)
<?php $postindex = 1; if(!query_posts('showposts='.get_option('journal_home_posts').'&tag=homepost')){ if(get_option('journal_home_posts')!=''){ query_posts('showposts='.get_option('journal_home_posts')); }else{ query_posts('showposts=6'); } }else{ query_posts('showposts='.get_option('journal_home_posts').'&tag=homepost'); if(get_option('journal_home_posts')!=''){ query_posts('showposts='.get_option('journal_home_posts').'&tag=homepost'); }else{ query_posts('showposts=6&tag=homepost'); } } if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="postBox <?php if(($postindex % 3) == 0){ echo 'lastBox';}?>"> <div class="postBoxInner">(below this point, it begins drawing the custom post boxes using the class postBoxInner.)
The topic ‘Fixing a problem with query_posts’ is closed to new replies.