Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using this to retrieve posts on my index page:

<?php $posts = get_posts( "category=13&numberposts=2" ); ?> 
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?> 

[code]

Is there a way to include sticky posts on loops like that one? Or I'll have to use WP_Query?

share|improve this question
    
That will include sticky posts, if they are in the category you pick. Are you trying to include sticky posts in addition to the category you choose? –  s_ha_dum Apr 10 '13 at 2:01
    
get_posts() takes the same parameters as WP_Query() codex.wordpress.org/Template_Tags/get_posts#Parameters –  Michael Apr 10 '13 at 10:08
    
I would like to get the sticky posts of each category. –  Felipe Dário Apr 11 '13 at 2:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.