3 out of 3 members found this post helpful.

Postat în original de
Catalin Cerga
Salut
Cel mai simplu e sa nu incluzi restul postarilor in categorie, daca nu le vrei afisate... De ce le-ai vrea in categorie daca oricum n-apar pe listare?
Pentru organizarea interna, poate?
@edy: l-am scris direct snippet-ul (fara a-l testa), dar ar trebui sa functioneze.
Cod PHP:
function pre_get_posts_just_sticky( $query ) {
if ( $query->is_category() && $query->is_main_query() ) {
$query->set( 'ignore_sticky_posts', true );
$query->set( 'post__in', get_option('sticky_posts', array()) );
}
}
add_action( 'pre_get_posts', 'pre_get_posts_just_sticky' );
1 out of 1 members found this post helpful.
N-am la dispozitie tema Mono, dar pe Genesis + No Sidebar Pro (No Sidebar Pro Theme by StudioPress) functioneaza OK. Testat chiar acum (daca ai sticky posts din categoria afisata, atunci se afiseaza doar sticky posts, altfel se afiseaza toate).