Support » Plugins » Hacks » Help! Pagination issue with Categorization

  • Resolved squeaker2

    (@squeaker2)


    I hope I don’t seem too stupid, maybe I am going about this all wrong. I am only 1/2 way through my Associates Degree so this stuff is pretty advanced for me. My pagination works perfect if I don’t run a category first, but once sorted by category no such luck. Here are the snippets of code I think you will need. Any help is greatly appreciated!

    <?php if (isset($_GET['searchCat'])){
    			$myCAT = $_GET['searchCat'];
    			$hideheader = 'true';
    			query_posts('category_name='.$myCAT.''.'&posts_per_page='.$limitPagePosts.'');
    			}
    			else { query_posts($query_string.'&posts_per_page='.$limitPagePosts.'');}
    		?>
    		<?php $count = 0; $postid = 0;?>
    		<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    
    LOOP CODE
    
    <?php endwhile; ?>
    
    		<?php endif; ?>
    
    <div class="rightnav">
    	<div class="sortbycat">
        	SORT BY CATEGORY:
        </div>
    
        <div class="categories">
        	<a href="?searchCat=commercial-photography">Commercial Photography</a><br />
            <a href="?searchCat=event-photography">Events & Occassions</a><br />
            <a href="?searchCat=people-personas">People & Personas</a><br />
            <a href="?searchCat=adventures-travel">Adventures & Travel</a><br />
            <a href="?searchCat=senior-portraits">Senior Portraits</a><br />
            <a href="?searchCat=creative-artistic">Creative & Artistic Photos</a><br />
            <a href="?searchCat=wedding-photography">Wedding Photography</a><br />
            <a href="?searchCat=retouching-photo">Retouching / Photo Editing</a><br />
            <a href="?searchCat=links-tools">Links & Tools</a><br />
            <a href="?searchCat=training-tutorials">Training & Tutorials</a><br />
            <a href="?searchCat=featured-work">Our Work Featured</a><br />
            <a href="?searchCat=behind-scenes">Behind the Scenes</a><br />
        </div>
    
    </div>

    I believe I can pass the variables through the URL right? The initial query works PERFECT. It realizes how many posts/pages it needs to account for, but the actual link wont link to the next posts. After I click… pagination adds &paged=2 to the url. So, after clicking I end up with index.php?searchCat=event-photography&paged=2 but it still displays page1. I found some fixes online, but I could not implement them properly apparently. 🙁

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    (@esmi)

    Forum Moderator

    Try:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name='.$myCAT.''.'&posts_per_page='.$limitPagePosts.'&paged=' . $paged);
    squeaker2

    (@squeaker2)

    Thank you SO much.. omg i was getting frustrated, I really really appreciate your response!

    esmi

    (@esmi)

    Forum Moderator

    You’re very welcome. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help! Pagination issue with Categorization’ is closed to new replies.