WordPress.org

Ready to get started?Download WordPress

Forums

WP-Paginate
Pagination just refreshes the homepage (2 posts)

  1. pfrey
    Member
    Posted 10 months ago #

    My pagination is using a custom query, I tried to use this fix, but had no success. It seems to refresh the homepage regardless of what number I select in the pagination.

    <?php
    	$limit = get_option('posts_per_page');
    	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
    
    	if ( strstr( $url, "?filter=give" ) )
    		$custom_query = new WP_Query('cat=-3,-5,-24&meta_key=status-flag&meta_value=give&showposts=' . $limit=10 . '&paged=' . $paged);
    	elseif ( strstr( $url, "?filter=receive" ) )
    		$custom_query = new WP_Query('cat=-3,-5,-24&meta_key=status-flag&meta_value=receive&showposts=' . $limit=10 . '&paged=' . $paged);
    	else
    		$custom_query = new WP_Query('cat=-3,-5,-24&showposts=' . $limit=10 . '&paged=' . $paged);
    
    	$wp_query->is_archive = true; $wp_query->is_home = true;
    	?>
    	<div class="post-list">
    	<?php if ($custom_query->have_posts()) : ?>
    		<?php  ?>
    		<?php while ($custom_query->have_posts()) : $custom_query->the_post(); ?>
    			<div class="post">
    				<?php if ( '' != get_the_post_thumbnail() ) { ?>
    					<?php $attr = array('class' => 'alignleft'); ?>
    					<?php the_post_thumbnail('post-feature-thumbnail', $attr); ?>
    				<?php } else { ?>
    					<span class="alignleft avatar"><?php echo fullsize_post_author_avatar(); ?></span>
    				<?php } ?>
    				<div class="post-holder">
    					<?php
    					$key = 'status-flag';
    					$posttype = get_post_meta($post->ID, $key, TRUE);
    					?>
    					<h2>
    					<span class="adtype">
    						<?php if ($posttype != "") : ?>
    							<?php echo $posttype . ': '; ?>
    						<?php endif; ?>
    					</span>
    					<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    					</h2>
    					<span class="note">Posted by <a href="<?php echo bp_core_get_user_domain($post->post_author); ?>"><?php the_author(); ?></a></span>
    					<?php the_excerpt(); ?>
    				</div>
    			</div>
    		<?php endwhile; ?>
    	</div>
    </div>
    <?php if(function_exists('wp_paginate')) {
    	wp_paginate(false,$custom_query);
    } ?>

    http://wordpress.org/extend/plugins/wp-paginate/

  2. pfrey
    Member
    Posted 10 months ago #

    Also, a similar setup to this worked previously with a different theme. Is there something I should look for in my new theme to ensure this would work?

Reply

You must log in to post.

About this Plugin

About this Topic