Search pagination wordpress - wordpress

i have a problem with search result page, the pagination doesn't works, when i want to go to next page, i'm redirected to index page, but the url is: www.mywebsite.com/page/2/?s=word..
For all pages the pagination works, only for search doesn't works.
this is the code of search.php
<?php
/**
* The template for displaying Search Results pages.
*/
get_header(); ?>
<?php
$search = isset( $_GET['s'] ) ? $_GET['s']: null;
$user_filtre = '';
$user_display = '';
if( $search ){
$user_filtre .= 's=' . $_GET['s'] . '&';
$user_display .= 's=' . $_GET['s'] . '&';
}?>
<div id="main-search" class="content-dark hidden-sm hidden-xs">
<div class="container">
<form method="get" action="<?php bloginfo('url'); ?>" accept-charset="UTF-8">
<!--input name="s" id="s" type="hidden" -->
<div id="main-search-fields">
<p class="pull-left term">Search Term:</p>
<input name="s" value="<?php the_search_query(); ?>"autocomplete="off" type="search">
</div>
<div id="main-search-btn">
<input class="button-green-download-big" type="submit" value="Search">
</div>
</form>
</div>
</div>
<div class="browse-content">
<div class="container">
<section>
<div class="row">
<ul>
<?php if(have_posts() ): ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php include '_includes/items/item_2.php';?>
<?php endwhile; ?>
<?php endif; ?>
</ul>
</div>
</section>
<?php novavideo_theme_pagination(); ?>
</div>
</div>
</div>
Anyone have an ideea?
item_2.php.
<div class="browse-movie-wrap col-xs-10 col-sm-4 col-md-5 col-lg-4">
<a href="<?php the_permalink(); ?>" class="browse-movie-link">
<figure>
<?php if($values = get_post_custom_values("poster_url")) { ?>
<img class="img-responsive" src="<?php echo $values[0]; ?>" alt="<?php the_title();?> Watch Online" width="210" height="315">
<?php } ?>
<figcaption class="hidden-xs hidden-sm">
<span class="fa fa-star icon-color"></span>
<h4 class="rating"><?php $rating = get_post_custom_values("imdbRating"); echo $rating[0]; ?> / 10</h4>
<h4>
<?php $categories = get_the_category();
if ( ! empty( $categories[0] ) ) {
echo esc_html( $categories[0]->name );
}
?>
</h4>
<h4 class="quality-button"><span class="fa fa-play-circle"></span> <?php $terms_as_text = strip_tags( get_the_term_list( $wp_query->post->ID, 'quality', '', ', ', '' ) ); echo $terms_as_text;; ?></h4>
<span class="button-green-download-big margin-button">Open Movie</span>
</figcaption>
</figure>
</a>
<div class="browse-movie-bottom">
<?php $title = get_post_custom_values("Title"); echo $title[0]; ?>
<div class="browse-movie-year"><?php $terms = wp_get_post_terms($post->ID, 'release-year', array("fields" => "all")); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term_single ) { $term_link = get_term_link( $term_single ); echo $term_single->name; } } ?></div>
</div>
</div>

Search results are instantiated through query_posts and that controls how many results you have per page. In your code, it's probably happening via the include: /_includes/search-template.php but if not, set it up like this:
// 1- Created a paged variable that knows how many paginated pages exist (depends on your site)
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
// 2- Pass `paged` into array of arguments for query_posts
$args = array(
'posts_per_page' => 20,
'order' => 'DESC',
'paged' => $paged,
);
// 3- Submit query_posts to WordPress with arguments set
query_posts( $args );
Now you can use next_posts_link(); to show the paginated page link. Just replace the references to theme_pagination(); with next_post_link(); and it should output the right results.
If you want to abstract all this logic out of your template, check out pre_get_posts. It's a different method and you would put all this logic into functions.php but will achieve similar results.

This is my code for Search result page with pagination:
<?php get_header(); ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/search.css">
<?php wp_head(); ?>
<script type="text/javascript">
var window_width = window.screen.width;
var window_height = window.screen.height;
<?php $window_width = "<script>document.write(window_width)</script>";
$window_height = "<script>document.write(window_height)</script>"; ?>
</script>
<style>
.sm_bd{padding: 5px;
border: 1px solid
#ccc;}
.row {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
}
.row > [class*='col-'] {
display: flex;
flex-direction: column;
}
.previous,.next {
padding: 5px;
border: 1px solid
#ccc;
border-radius: 4px;
margin: 15px;
}
</style>
</head>
<body class="index-body">
<?php include 'menu.php';?>
<div class="col-xs-12 col-sm-12 blog-page no-marg no-padd">
<div class="col-xs-4 col-sm-3 single-sidebar no-marg no-padd">
My sidebar
</div>
<section id="primary" class="content-area col-xs-12 col-sm-12 col-lg-8 col-md-8">
<div id="content" class="site-content row" role="main">
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : '1';
$s=get_search_query();
$args = array(
's' =>$s,
'paged' => $paged,
'posts_per_page' => '12',
);
// The Query
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
_e("<h2 style='font-weight:bold;color:#000'>نتایج جستجو برای: ".get_query_var('s')."</h2>");
echo "<div class='col-lg-12 col-md-12'><hr/></div>";
while ( $the_query->have_posts() ) {
$the_query->the_post();
?>
<div class="col-xs-12 col-sm-12 col-lg-3 col-md-3 sm_bd">
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php else : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<img class="attachment-post-thumbnail size-post-thumbnail wp-post-image lazyloaded" src="Without Image"
alt="<?php the_title_attribute(); ?>"
title="<?php the_title_attribute(); ?>" width="300" height="449">
</a>
<?php endif;?>
<?php the_title(); ?>
</div>
<?php
}
?>
<div class="pagination" id="blog-pagination">
<?php if( get_previous_posts_link('← ', $loop->max_num_pages ) ) : ?>
<span class="previous" ><?php previous_posts_link( '→ ', $loop->max_num_pages ); ?></span>
<?php endif; ?>
<?php if( get_next_posts_link('← ', $loop->max_num_pages ) ) : ?>
<span class="next"><?php next_posts_link( '←', $loop->max_num_pages ); ?></span>
<?php endif; ?>
</div>
<?php
}
else{
?>
<h2 style='font-weight:bold;color:#000'>not found title</h2>
<div class="alert alert-info">
<p>not found alert</p>
</div>
<?php }
wp_reset_postdata();?>
</div><!-- #content .site-content -->
</section><!-- #primary .content-area -->
</div>
<?php get_footer(); ?>
don't forget to write wp_reset_postdata(); after post loop.

Related

Posts pagination not working in front page

This question has asked many time before and none has answers my question. I went through most of the answers before post this.
I have a pagination query in home page. Pagination is showing and I can going through the pages. But same posts are displaying for every paginate link.
This is my code so far. Can anybody elaborate the wrong here?
<?php
$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
$args = array(
'post_type'=>'post',
'posts_per_page'=>10,
'orderby'=>'date',
'order'=>'DESC',
'offset'=>3,
'paged'=>$paged
);
$blogs = new WP_Query($args);
if($blogs->have_posts()):
while($blogs->have_posts()): $blogs->the_post();
?>
<div class="col-md-6">
<div class="single-post">
<div class="thumb">
<a href="<?php the_permalink(); ?>">
<img src="<?php the_post_thumbnail_url('blog-thumbnail'); ?>" alt="<?php the_title(); ?>" class="img-fluid" />
</a>
</div>
<div class="content">
<div class="category">
<?php
$categories = get_the_category();
foreach ($categories as $key => $category) {
echo ''. $category->name. '';
}
?>
</div>
<h3><?php the_title(); ?></h3>
<div class="metadata">
<span class="date"><?php echo get_the_date(); ?></span>
<span class="author"><?php echo get_the_author(); ?></span>
</div>
<div class="excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</div>
</div>
<?php
endwhile;
echo '<div class="paginate-wrap">'. paginate_links() . '</div>';
endif;
wp_reset_query();
?>
Thanks in advance
Found the solution. Is anybody facing the same please check this.
My code is right, but because of the offset parameter pagination is not working. I found the solution here.
So, this is my final code:
<?php
$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
$per_page = 10;
$defualt_offset = $offset;
if ($paged == 1) {
$offset = $default_offset;
} else {
$offset = (($paged - 1) * $per_page) + $default_offset;
}
$args = array(
'post_type'=>'post',
'posts_per_page'=>$per_page,
'orderby'=>'date',
'order'=>'DESC',
'offset'=>3,
'paged'=>$paged
);
$blogs = new WP_Query($args);
if($blogs->have_posts()):
while($blogs->have_posts()): $blogs->the_post();
?>
<div class="col-md-6">
<div class="single-post">
<div class="thumb">
<a href="<?php the_permalink(); ?>">
<img src="<?php the_post_thumbnail_url('blog-thumbnail'); ?>" alt="<?php the_title(); ?>" class="img-fluid" />
</a>
</div>
<div class="content">
<div class="category">
<?php
$categories = get_the_category();
foreach ($categories as $key => $category) {
echo ''. $category->name. '';
}
?>
</div>
<h3><?php the_title(); ?></h3>
<div class="metadata">
<span class="date"><?php echo get_the_date(); ?></span>
<span class="author"><?php echo get_the_author(); ?></span>
</div>
<div class="excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</div>
</div>
<?php
endwhile;
echo '<div class="paginate-wrap">'. paginate_links() . '</div>';
endif;
wp_reset_query();
?>

Vc addon not displaying properly as adde

I have made the visual composer addon to meet one of the requirement. However I have found that it always come above the other vc elements.
I have tried to add the class as per vc composer other elements
public function sim_product($attr)
{
?>
<div class="vc_column-inner"><div class="wpb_wrapper">
<div class="wpb_text_column wpb_content_element ">
<div class="wpb_wrapper">
<div class="more-project-list">
<?php
$select = $attr['sim_product_id'];
$query = new WP_Query( array( 'post_type' => 'products','post__in' => explode(",",$select) ));
if ( $query->have_posts() ) { ?>
<?php while ( $query->have_posts() )
{ $query->the_post(); ?>
<div class="single-blk" style='background-color: <?php echo the_field('colour');?>'>
<div class="title">
<?php the_title();?>
</div>
<figure>
<?php if (has_post_thumbnail( $query->ID ) )
{
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $query->ID ), 'single-post-thumbnail' ); ?>
<img src="<?php echo $image[0]; ?>" alt="">
<?php }?>
</figure>
<div class="category">
<?php
$terms = wp_get_post_terms( $query->post->ID, array( 'Product_category') );
foreach ( $terms as $term ) { echo $term->name;}
?>
</div>
</div>
<?php }}?>
</div>
</div></div></div></div>
<?php
}
It isnt coming where I have placed it it always come on top

Query related posts, Wrap in Row every 3 posts

I'm trying to query some related posts and wrap them in a row div every 3 posts. I've checked all the questions regarding this but still my query renders a mess.
This is what I have so far:
<?php
$related = get_posts( array(
'category__in' => wp_get_post_categories($post->ID),
'numberposts' => 6,
'post__not_in' => array($post->ID) ) );
$counter=0;
if( $related ) foreach( $related as $post ) {
setup_postdata($post); $counter++;
?>
<div class="row">
<article class="third-width">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="third-link">
<?php the_post_thumbnail('post-parrilla'); ?>
</a>
<?php exclude_post_categories("8"); ?>
<div class="clear"></div>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="third-link">
<div class="post-title">
<span><?php the_title(); ?></span>
</div>
</a>
</article>
<?php if ($counter%3==0):?>
</div><div class="row">
<?php endif;?>
<?php } wp_reset_postdata(); ?>
Thank you in advance
Use below code
<?php
$related = get_posts( array(
'category__in' => wp_get_post_categories($post->ID),
'numberposts' => 6,
'post__not_in' => array($post->ID) ) );
if( $related )
{
$counter = 0;
?>
<div class="row">
<?php
foreach( $related as $post ) {
setup_postdata($post);
if ($counter%3==0){
?>
</div><div class="row">
<?php
}
?>
<article class="third-width">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="third-link">
<?php the_post_thumbnail('post-parrilla'); ?>
</a>
<?php exclude_post_categories("8"); ?>
<div class="clear"></div>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="third-link">
<div class="post-title">
<span><?php the_title(); ?></span>
</div>
</a>
</article>
<?php
$counter++;
}
?>
</div>
<?php
}
wp_reset_postdata();
?>

List custom taxonomies by custom field

Below I have my custom taxonomy template and its working fine until now.
<?php
/*
Template Name: Performer List Page
*/
get_header(); ?>
<?php
// if show all is set
$sortby=$_GET['sortby'];
if( isset($_GET['showall']) || isset($sortby) ):
$args = array( 'hide_empty' => 0 );
else:
// else show paged
$page = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;
global $framework_opt,$post; $number_of_performers = $framework_opt['performers_per_page'];
$orderby = 'date';
$order = isset( $_REQUEST['order'] ) ? trim( $_REQUEST['order'] ) : null;
if(isset($_GET['order']) && !empty($_GET['order'])) {
switch($order)
{
case 'alphabetically' : $orderby = 'title';
break;
case 'popularity' : $orderby = 'count';
break;
/*
case 'female' : $meta = 'gazi_female';
break;
case 'male' : $meta = 'gazi_male';
break;
*/
default : $orderby = 'date';
break;
}
}
// number of tags to show per-page
$per_page = $number_of_performers ;
$offset = ( $page-1 ) * $per_page;
$args = array( 'orderby' => $orderby, 'number' => $per_page, 'meta_key' => $meta, 'offset' => $offset, 'hide_empty' => 0 );
endif;
$taxonomy = 'performer';
$count_performers = wp_count_terms( $taxonomy, $offset );
$tax_terms = get_terms( $taxonomy, $args );
?>
<aside class="sidebar pull-left">
<p class="sidebar-title"><?php _e( 'SEARCH BY LETTER', 'gazi' ); ?></p>
<div class="letter-search clearfix">
<span class="letter">A</span>
<span class="letter">B</span>
<span class="letter">C</span>
<span class="letter" style="width:40%"><?php _e( 'All', 'gazi' ); ?></span>
<span class="letter" style="width:40%"><?php _e( 'Reset', 'gazi' ); ?></span>
</div>
<!--<p class="sidebar-title"><?php _e( 'QUICK SEARCH', 'gazi' ); ?></p>
<form class="frm-search-tag has-title" action="<?php echo home_url( '/' ); ?>" method="get">
<input type="text" placeholder="Search name" name="s" value="" />
<button type="submit"><span class="ico ico-search"></span>
<select class="search_tools" style="display:none;" name="taxonomy" >
<option value="performer">Videos</option>
<option value="gallery">Photos</option>
</select>
</button>
</form>-->
<div style="height: 5px;"></div>
<?php get_template_part( 'templates/sidebars/performer-sidebar', get_post_format() ); ?>
</aside>
<section class="main-section pull-left">
<div class="page-title with-sorter clearfix">
<h1><?php the_title(); ?></h1>
<div class="info hidden-mobile">
<p>
<?php echo $count_performers; ?><?php _e( 'Performers', 'gazi' ); ?> <span class="ico ico-tv"></span>
</p>
<div class="sorter">
<div class="dropdown-container">
<ul class="flyout-menu flyout-menu-right">
<li>
<button class="dropdown-toggle" type="button" data-action="dropdown-toggle" data-target="#sorter-dropdown">SORT</button>
<div class="flyout-menu-content" id="sorter-dropdown">
<ul class="flyout-menu-items">
<li>
<?php _e( 'Alphabetically', 'gazi' ); ?> </li>
<li>
<?php _e( 'Popularity', 'gazi' ); ?> </li>
</ul>
</div>
</li>
</ul>
</div></div> </div>
<div class="info visible-mobile clearfix">
<button class="btn-pd btn-pd-primary pull-left" style="margin-right: 0;" data-action="scroll-to" data-target="#letter-search">A-Z</button>
<p style="float:right">
<?php echo $wp_query->found_posts; ?> <?php _e( 'Performers', 'gazi' ); ?> <span class="ico ico-tv"></span></p>
</div></div>
<div id="performer-list" class="list-view">
<div id="performer-thumbs" class="performer-listing clearfix">
<div class="items">
<?php foreach ($tax_terms as $cat) : ?>
<?php
$flag = 0;
if( $sortby == substr( $cat->name, 0, 1 ) || $sortby=='' ) { $flag = 1;}
if ($flag=='1'){
?>
<article class="performer-item">
<a class="outline" href="<?php echo get_term_link($cat->slug, 'performer'); ?>" title="<?php echo $cat->name; ?>">
<?php $performer_image = z_taxonomy_image_url($cat->term_id); if(!empty($performer_image)) : ?>
<img src="<?php bloginfo('template_directory'); ?>/gazi/css/images/1pixel.gif" data-src="<?php echo z_taxonomy_image_url($cat->term_id,NULL, array(180, 240)); ?>" alt="<?php echo $cat->name; ?>" />
<noscript><img src="<?php echo z_taxonomy_image_url($cat->term_id,NULL, array(180, 240)); ?>" alt="<?php echo $cat->name; ?>" /></noscript>
<?php else : ?>
<img src="<?php bloginfo('template_directory'); ?>/gazi/css/images/1pixel.gif" data-src="<?php bloginfo('template_directory'); ?>/gazi/css/images/no-img-women.jpg" alt="<?php echo $cat->name; ?>" />
<noscript><img src="<?php bloginfo('template_directory'); ?>/gazi/css/images/no-img-women.jpg" alt="<?php echo $cat->name; ?>" /></noscript>
<?php endif; ?>
<span class="performer-name"><?php echo $cat->name; ?></span>
<span class="performer-videos hidden-mobile">
<span class="count"><?php echo $cat->count; ?></span>
<span class="txt"><?php _e( 'VIDEOS', 'gazi' ); ?></span>
</span>
</a>
<div class="performer-item-footer visible-mobile">
<span class="ico ico-take"></span> <?php echo $cat->count; ?> <?php _e( 'VIDEOS', 'gazi' ); ?> </div>
</article>
<?php } ?>
<?php endforeach; ?>
</div>
</div>
<?php
if( isset($_GET['showall']) || isset($sortby)):
echo '';
else:
// showall is set, show link to get back to paged mode
$total_terms = wp_count_terms( 'performer' );
$pages = ceil($total_terms/$per_page);
// if there's more than one page
if( $pages > 1 ):
echo '<div class="pager"><div class="paginator" id="performer_paginator">';
for ($pagecount=1; $pagecount <= $pages; $pagecount++):
echo '<a class="page" href="'.get_permalink().'page/'.$pagecount.'/"><span>'.$pagecount.'</span></a>';
endfor;
// link to show all
echo '<a class="page" href="'.get_permalink().'?showall=true">ALL</a>';
echo '</div>';
endif;
endif;
?>
</div>
<div id="letter-search" class="visible-mobile">
<div class="section-title with-sorter clearfix" style="margin-bottom: 4px;">
<p class="title">Letters Search</p>
<div class="info">
<button class="btn-pd btn-pd-sm btn-pd-primary pull-right" data-action="scroll-to" data-target="#performer-thumbs"><span class="ico ico-grid"></span></button>
</div>
</div>
<div class="letter-search clearfix">
<span class="letter">A</span>
<span class="letter">B</span>
<span class="letter">C</span>
</div>
</div>
<?php get_template_part( 'templates/advertisements_bottom', get_post_format() ); ?>
</section>
<?php get_footer(); ?>
If you see I added an order menu for popularity and videos count for this listing is working but under the order code you will see:
/*
case 'female' : $meta = 'gazi_female';
break;
case 'male' : $meta = 'gazi_male';
break;
*/
so I want to separate performers by male and female using the custom fields above.Any one that has any idea how to complete this template?
thanks
You want to show results based on meta field 'gazi_female' or 'gazi_male' so you should include in your meta_query arguments.
Instead of 'meta_key' => $meta use meta_query. Meta query in get_terms feature got introduced from 4.4.0 version, so make sure your version supports it with get_terms()
You should not use it in order_by parameter since order_by will sort the results and it cant filter results.
Alternatively try WP_Term_Query which is available from 4.6 versions
// WP_Term_Query arguments
$args = array (
'taxonomy' => array( 'performer' ),
'meta_key' => 'male',
'meta_value' => 'gazi_male',
);
// The Term Query
$term_query = new WP_Term_Query( $args );
// The Loop
if ( ! empty( $term_query ) && ! is_wp_error( $term_query ) ) {
// do something
} else {
// no terms found
}

Wordpress category template is showing posts from all categories instead of specific category posts

I have an archive page that's set up to display category specific posts. However, instead of showing only the posts from a given category on the category page, it's showing all posts. For an example, see here.
Here's the code I'm using on my archive.php page. I know it's improper use of the loop, but I'm not sure how to fix it. Thanks for the help.
<?php get_header(); ?>
<div id="content">
<div id="inner-content" class="wrap clearfix">
<h1 class="blogTitle" style="margin:10px 0 3px 0;">Blog Title</h1>
<nav class="blogNav" role="navigation">
<?php bones_blog_nav(); // Adjust using Menus in Wordpress Admin ?>
</nav>
<div id="main" class="eightcol first clearfix" role="main">
<div class="catwhiteBg">
<?php if (is_category()) { ?>
<h1 class="catTitle">
<span><?php _e("", "bonestheme"); ?></span> <?php single_cat_title(); ?>
</h1>
<?php echo category_description( $category_id ); ?>
<?php } elseif (is_author()) { ?>
<div class="authorTop">
<?php
$curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author'));
?>
<div class="author-pic"><?php echo get_avatar( $curauth->user_email, '80' ); ?></div>
<div class="author-name"><span style="font-weight: 200; color: #575757;">POSTS BY:</span>
<?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?>
</div>
<div class="author-bio"><?php echo $curauth->description; ?></div>
<div class="author-twitter"><span>twitter</span></div>
</div>
<?php } elseif (is_day()) { ?>
<h1 class="archive-title h2">
<span><?php _e("Daily Archives:", "bonestheme"); ?></span> <?php the_time('l, F j, Y'); ?>
</h1>
<?php } elseif (is_month()) { ?>
<h1 class="archive-title h2">
<span><?php _e("Monthly Archives:", "bonestheme"); ?></span> <?php the_time('F Y'); ?>
</h1>
<?php } elseif (is_year()) { ?>
<h1 class="archive-title h2">
<span><?php _e("Yearly Archives:", "bonestheme"); ?></span> <?php the_time('Y'); ?>
</h1>
<?php } ?>
</div>
<div class="psts">
<?php
global $wp_query;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
query_posts(array('posts_per_page' => '8','paged'=>$paged));
?>
<?php
$count = 1;
while (have_posts()) : the_post(); ?>
<div class="sixcol small pst<?php if ((isset($count)) && ($count % 2 == 0 )) { echo ' last';} // same logic to add class of last to last item in row of two ?>" id="post-<?php the_ID(); ?>">
<article id="post-<?php the_ID(); ?>" role="article">
<div class="thumb-wrapper mobile">
<?php if(has_post_thumbnail()) { $image_src = wp_get_attachment_image_src( get_post_thumbnail_id(),'post-thumb' ); echo '<img src="' . $image_src[0] . '" width="100%" class="post-thumb" />'; } ?>
<header class="post-thumb-header">
<h2 class="post-title"><?php the_title(); ?></h2>
</header> <!-- end article header -->
<p class="meta"><?php the_category(', '); ?></p>
</div>
<section class="mobile-content">
<?php the_excerpt(); ?>
</section>
</article> <!-- end article -->
</div>
<?php $count++; ?>
<?php endwhile; ?>
<nav class="wp-prev-next">
<?php echo rb_pagination(); ?>
</nav>
</div> <!-- end .psts -->
</div> <!-- end #main -->
<?php get_sidebar(); // sidebar 1 ?>
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>
I think you're overriding the original query with this line:
query_posts(array('posts_per_page' => '8','paged'=>$paged));
Can you swap this line with this, and let me know the results?
global $query_string;
query_posts( $query_string . "&posts_per_page=8&paged=$paged" );
if that fails try this:
query_posts(array('posts_per_page' => '8','paged'=>$paged, 'cat' => $category_id ));

Resources