edit 3/2427/2011, working code
<?php
/**
* Template Name: agentSearch
*/
get_header(); ?>
<div class="fullWidthContent">
<h1>
<?php the_title(); ?>
</h1>
</div>
<div id="agentsContainer">
<?php
$loop = new WP_Query( array(
'post_type' => 'agents',
'orderby' => 'meta_value',
'meta_key' => 'rw_dname',
'order'=>'ASC',
'meta_query' => array(
array( 'key' => 'dName''rw_dName' )
),
'post__not_in' => array( 98'98' ),
'posts_per_page' => -1 ) );
$loop2 = new WP_Query( array(
'post_type' => 'agents',
'post__in' => array( 98'98' ) ) );?>
<?php
if($loop->have_posts() || $loop2->have_posts()) {
if($loop->have_posts()) { while($loop->have_posts()) { $loop->the_post();?>
<div class="agentContent">
<div class="agentThumbnail">
echo<?php the_title
if ( has_post_thumbnail();
) { // check if the post echohas get_post_custom_valuesa Post Thumbnail assigned to it.
the_post_thumbnail('rw_dName');
}?>
</div>
<div class="agentInfo"> <span class="agentInfoEntry">
<?php
$meta = get_post_meta(get_the_ID(), 'rw_dname', true);
echo $meta; //Post Contentif you want to show
?>
}</span> </div>
</endwhilediv>
<?php
} //endwhile
}
?>
<?php
if($loop2->have_posts()) { while($loop2->have_posts()) { $loop2->the_post();?>
<div class="agentContent">
<div class="agentThumbnail">
echo<?php the_title
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}
?>
</div>
<div class="agentInfo"> <span class="agentInfoEntry">
echo get_post_custom_values <?php
$meta = get_post_meta('rw_dName'get_the_ID(), 'rw_dname', true);
echo $meta; // if you want to show
?>
/ </Postspan> Content</div>
</div>
<?php
} //endwhile
}
?>
<?php
} else {
echo 'No Agents.';
}
?>
<?php get_footer(); ?>