I would like to do custom search pages that allow users to see posts written by one and only one specific author.
For example, let Bob and Bill be the authors on a blog. One page would allow me to see all of Bob's posts by default and to search within, and another would allow me to do the same with Bill's.
The following code allows me to see all posts, but I want to customize it to filter by author and to add a search function. Anyone can suggest an easy fix?
$args=array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'List of Posts';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
</p>
<?php the_excerpt();
endwhile;
}
wp_reset_query(); // Restore global post data stomped by the_post().