Forums

Fixing a problem with query_posts (3 posts)

  1. altoidboy
    Member
    Posted 1 year ago #

    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.)

  2. bryanwiz
    Member
    Posted 11 months ago #

    altoidboy: I'm using JournalCrunch on a project, too. Any luck with getting pagination on the front page to work??

    I read your post about the category page pagination, too. Where'd you place that PHP code? In the page.php file? Please enlighten me. It sounds like you got that to work. Congrats!

    I really liked using this template, except for those glaring misses. :-/ Thanks! -B

  3. altoidboy
    Member
    Posted 11 months ago #

    See this thread for all the info I have...

    http://forums.site5.com/showthread.php?t=30394

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags