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 have edited the loop in my archive.php to show my posts in random order. I am trying to have a sticky post showing before the random posts. Can you please help me with the sticky post code in my custom loop. I would really appreciate any help.

  if ( have_posts() ) 

    if ( have_posts() ) {

query_posts($query_string . '&orderby=rand');

        while ( have_posts() ) {

            get_template_part( 'content', get_post_format() );
            get_template_part( 'tech', 'ads' );

        } //End While loop
share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.