WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Pagination on custom post_type

[Resolved] Pagination on custom post_type

  • Hi,

    I am using WordPress3.5.1 + Magic Fields plugin(v2.1). Everything works great, except I can’t seem to get the pagination working. My URL(courses is the post_type) looks like this “http://mysite.com/courses/”. When I click the “next” pagination link it changes the URL to “http://mysite.com/courses/page/2/” and takes me to a 404 page. Has anyone come accross this issue before? My pagination code looks like this…

    <?php
    
    		    $start = max(1, $paged - 4);
    		    $end = min ( $loop->max_num_pages, $paged + 4);
    
    		    if( $paged > 1) { ?>
    		        <a href="<?php echo get_pagenum_link($paged-1);?>"><</a>
    		    <?php }
    
    		    for($i = $start; $i <= $end; $i++) { ?>
    		        <a href="<?php echo get_pagenum_link($i);?>" <?php echo ($paged==$i)? 'class="active"':'';?>><?php echo $i;?></a>
    		    <?php }
    
    		    if($paged != $loop->max_num_pages ) { ?>
    		    	<a href="<?php echo get_pagenum_link($paged+1);?>">></a>
    	    	<?php } ?>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Pagination on custom post_type’ is closed to new replies.