• I’m using a custom query on my homepage but when I use this query, the ‘sticky’ class does not get added to post_class(). Can anyone tell me why?

    Removing ‘category__in’=>$includes, solves the problem but I need to limit the categories displayed on this page.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$args=array(
    		'category__in'=>$includes,
    		'paged'=>$paged,
    		'showposts'=>5
    	);
    	query_posts($args);
Viewing 1 replies (of 1 total)
  • Thread Starter Sebastien Couture

    (@scouture)

    I’ve changed the code to this rather to exclude the categories that I don’t want. This way the categories do in fact get removed and i see the stiky post, however WP seems to think I’m always on the homepage. For instance, if I go to a category archive, I still get the same posts as I see on the home.

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    	$post_per_page = 7;
    
    	$exculde = array_merge(cat_and_kids(20), cat_and_kids(21), cat_and_kids(366));
    
    	$args=array(
    		'category__not_in'=>$exculde,
    		'paged'=>$paged,
    		'showposts'=>$post_per_page
    	);

    cat_and_kids() is a function I created that puts a category ID and all those of it’s children in an array.

Viewing 1 replies (of 1 total)
  • The topic ‘query_posts() does not add sticky class in post_class()’ is closed to new replies.