I have a functioning wp_query loop that is pulling all of the employees for a company from a custom post type. I figured out how to display the employees in alphabetical order by last name. I now need to show the owner of the company at the very start of the list of employees on the front of the site but still need the rest of the employees to flow in rows.
I know that I could use 2 separate loops but that seems like overkill when the first loop would only be used to pull a certain post and display it.
Is there a way to build a loop that pulls a single post and always displays it first and then runs the loop to display the rest of the results in alphabetical order by last name?
Here are the loop and part of the display code as I have it right now:
<div class="row team-row">
<?php add_filter( 'posts_orderby', 'posts_orderby_lastname' );
$loop = new WP_Query( array(
'post_type' => 'team',
'location' => $location->slug
) );
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-md-2 team-member">
<?php the_post_thumbnail('medium'); ?>
<h3 class="entry-title"><?php the_title( '' ); ?></h3>
<span class="team-position"><?php the_field('position'); ?></span><br />
<span class="team-phone"><?php the_field('phone'); ?></span><br />
<button class="btn btn-small team-btn" data-toggle="modal" data-target="#team-<?php the_ID(); ?>">
View Bio
</button>
<div class="modal fade" id="team-<?php the_ID(); ?>" tabindex="-1" role="dialog" aria-labelledby="team-<?php the_ID(); ?>Label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="team-<?php the_ID(); ?>Label"><?php the_title( '' ); ?></h4>
</div>
<div class="modal-body">
<div class="entry-content">
<?php the_content(); ?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; ?>