Your category.php
should have two loops — one for stickies, one for regular posts:
<?php
// get sticky posts array
$sticky = get_option('sticky_posts');
// First WP_Query arguments
$args = array(
// include stickies
'post__in' => $sticky
);
$query = new WP_Query( $args );
// First loop for stickies only
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post() );
echo get_the_title() . '<br />';
echo get_the_content() . '<br />';
endwhile; endif;
wp_reset_postdata(); // don't forget to reset before the next loop
/***************************************/
// Second WP_Query arguments
$args = array(
// exclude stickies
'post__not_in' => $sticky
);
$query = new WP_Query( $args );
// Second loop for posts excluding stickies
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post() );
echo get_the_title() . '<br />';
echo get_the_content() . '<br />';
endwhile; endif;
wp_reset_postdata(); // if necessary
More than likely, you will need a lot of additional WP_Query
parameters.
- See WP_Query;
- See Sticky Posts