I have a small problem with this function ! I would like to exclude all sticky post from my query but when I do it, it breaks my pagination. In the following code, when I remove the "'post__not_in' => $sticky" my pagination works like a charm...
Any advice would be much appreciated !
Cheers.
/* Exculde STICKY from the main QUERY */
function exclude_cat(){
if (is_home()) {
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$sticky = get_option( 'sticky_posts' );
$args = array(
'category__not_in' => array( 71 ),
'ignore_sticky_posts' => 1,
'post__not_in' => $sticky,
'paged' => $paged
);
query_posts($args);
}
}
post__not_in
arg if you're usingignore_sticky_posts
(caller_get_posts
pre 3.1)... or at least it shouldn't be needed.caller_get_posts
instead ofignore_sticky_posts
if you're running anything less than WordPress 3.1 (eg. 3.0.5)ignore_sticky_posts
bycaller_get_posts
, however if I remove the linepost__not_in
the pagination appears but the sticky posts too... Very frustrating.get_query_var('page')
should actually beget_query_var('paged')
, see if changing that fixes the problem, alongside the other changes suggested.