• Resolved avato

    (@avato)


    Hello,

    On my site i’m trying to have a blog section and a portfolio section and want to be able to blog as normal and post new portfolio item as a blog post, I’ve done this by creating the blog page excluding the portfolio category and the portfolio page only including the portfolio category. All works great until I get to the point where I need to go to previous entries. Page two, page three, page four is exactly the same as page one with both pages. Simply showing the same page over and over again.

    Anyone else had this problem, and fixed it?

    Appreciate any help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Not sure what your queries look like so will use this example

    proper pagination:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('cat=1&showposts='.get_option('posts_per_page').'&paged=' . $paged);
    ?>

    Thread Starter avato

    (@avato)

    Ooops sorry. Tried the code you said still did not work. My code is below.

    <?php if (have_posts()) : ?>
    
    <?php query_posts("cat=-8");  ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			// Content Here
    
    		<?php endwhile; ?>
    
    			<span id="previous-entries"><?php next_posts_link('&laquo; Previous Entries') ?></span>
    			<span id="next-entries"><?php previous_posts_link('Next Entries &raquo;') ?></span>
    
    	<?php else : ?>
    
    	// not found content
    
    	<?php endif; ?>

    try

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string . '&cat=-3&paged=' . $paged);
    ?>
    <?php if (have_posts()) : ?>
    
    <?php while (have_posts()) : the_post(); ?>
    			// Content Here
    
    		<?php endwhile; ?>
    
    			<span id="previous-entries"><?php next_posts_link('&laquo; Previous Entries') ?></span>
    			<span id="next-entries"><?php previous_posts_link('Next Entries &raquo;') ?></span>
    
    	<?php else : ?>
    
    	// not found content
    
    	<?php endif; ?>

    `

    Thread Starter avato

    (@avato)

    That worked perfectly thank you so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude category problem (query_posts)’ is closed to new replies.