problem with pagination
-
this is my search.php code and pagination is not working when i click next link
localhost:8080/browseintern/?s=media&post_type=job&cat=-1&sity=-2&paged=2this url is showing page is not found ….this is not come back with my search page
<?php get_header(); ?> <div id="content"> <?php if($_GET['post_type']=='job') { $post_type=$_GET['post_type']; $paged = (get_query_var('page')) ? get_query_var('page') : 1; if (isset ($_GET['s']) && $_GET['s']!='Search ...' && $_GET['cat']== -1 && $_GET['sity']== -2) { $temp = $wp_query; $wp_query= null; $keyword=$_GET['s']; $wp_query = new WP_Query( array( 's' => $keyword ,'post_type' => $post_type, 'posts_per_page' => 2,'paged'=>$paged) ); } if( isset ($_GET['s']) && $_GET['s']!='Search ...' && $_GET['cat']!= -1 && $_GET['sity']== -2) { $keyword=$_GET['s']; $catid=$_GET['cat']; $temp = $wp_query; $wp_query= null; $args = array('post_type' => $post_type,'s' => $keyword , 'posts_per_page' => 5,'paged'=>$paged, 'tax_query' => array( array( 'taxonomy' => 'job_type', 'terms' => $catid ) ) ); $wp_query = new WP_Query( $args ); } if( isset ($_GET['s']) && $_GET['s']!='Search ...' && $_GET['cat']!= -1 && $_GET['sity']!= -2) { $sity=$_GET['sity']; $keyword=$_GET['s']; $catid=$_GET['cat']; $temp = $wp_query; $wp_query= null; $args = array('post_type' => $post_type,'s' => $keyword , 'posts_per_page' => 5,'paged'=>$paged, 'tax_query' => array( array( 'taxonomy' => 'job_type', 'terms' => $catid ) ), 'meta_query' => array( array( 'key' => 'wtf_comlocate', 'value' => $sity ) ) ); $wp_query = new WP_Query( $args ); } if( isset ($_GET['s']) && $_GET['s']!='Search ...' && $_GET['cat']== -1 && $_GET['sity']!= -2) { $sity=$_GET['sity']; $keyword=$_GET['s']; $catid=$_GET['cat']; $temp = $wp_query; $wp_query= null; $args = array('post_type' => $post_type, 's' => $keyword,'posts_per_page' => 5,'paged'=>$paged, 'meta_query' => array( array( 'key' => 'wtf_comlocate', 'value' => $sity ) ) ); $wp_query = new WP_Query( $args ); } ?> <?php if ($wp_query->have_posts()) : ?> <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="title"> <h2><a>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2> </div> <div class="postmeta"> <span class="date"> <?php the_time('M - j - Y'); ?></span> <span class="comm"><?php comments_popup_link('0 Comment', '1 Comment', '% Comments'); ?></span> <div class="postmetalocation"> <?php $loc = get_post_meta($post->ID, 'wtf_comlocate', true); echo $loc; ?></div> </div> <div class="entry"> <?php wpe_excerpt('wpe_excerptlength_archive', ''); ?> <div class="clear"></div> </div> </div> <?php endwhile; ?> <?php else : ?> <h1 class="title">Internship not found....Please search with related keyword</h1> <p>Sorry, but you are looking for something that isn't here.</p> <?php endif; //end pagination code....call function in function.php getpagenavi2($wp_query->max_num_pages);wp_reset_query(); $wp_query = null; $wp_query = $temp; } ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?> in my function.php function getpagenavi2($maxPageno){ ?> <div id="navigation" class="clearfix"> <?php if(function_exists('wp_pagenavi')) : ?> <?php wp_pagenavi() ?> <?php else : ?> <div class="alignleft"><?php //next_posts_link(__('« Older Entries','web2feeel')) next_posts_link(__('Older Entries',$maxPageno)); ?></div> <div class="alignright"><?php //previous_posts_link(__('Newer Entries »','web2feel')) previous_posts_link(__('Newer Entries')); ?></div> <div class="clear"></div> <?php endif; ?> </div> <?php }
[Moderator Note: Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged by the forum’s parser.]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘problem with pagination’ is closed to new replies.