Quantcast
Viewing all articles
Browse latest Browse all 10

middlesister on "previous link in category showing same current posts"

If you give a string to query_posts, then in order to keep your pagination bit replace the query_posts call with

query_posts( $query_string . '&category_name=life' );

If you don't keep the query string, then the loop won't know which page you are on and always give you the first posts. Using the array variant I gave above would be

global $wp_query;
$args = array_merge( $wp_query->query, array( 'category_name'=>'life' ) );
query_posts( $args );

These snippets are equivalent and go above the loop.


Viewing all articles
Browse latest Browse all 10

Trending Articles