I have a custom post type setup called 'Blog' and I have added the ability to assign authors to posts.
I want to be able to display a list of posts made by an author, however the posts never appear for the custom post type, even though posts have been made by the author the loop always displays: 'No posts by this author.'
Here is the loop in my author.php file:
<?php $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
<h1>Author: <?php echo $curauth->first_name; ?> <?php echo $curauth->last_name; ?></h1>
<!-- The Loop -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$postThumb = get_field( 'news_image' , $post->ID );
$postThumb = $postThumb['sizes']['insightsPostThumb'];
$cNewsBlogItem = array(
'img' => $postThumb,
'title' => $post->post_title,
'date' => date( 'd F, Y', strtotime( $post->post_date ) ),
'link' => get_permalink( $post->ID )
);
?>
<?php
if(!$cNewsBlogItem['img'] || $cNewsBlogItem['img'] == ""){
// if no img use fallback
$cNewsBlogItem['img'] = get_bloginfo('template_directory').'/images/news-fallback.jpg';
}
?>
<a class="cNewsBlogItem <?php echo $cNewsBlogItem['class']; ?>" href="
<?php echo $cNewsBlogItem['link']; ?>" title="<?php echo $cNewsBlogItem['title']; ?>">
<img src="<?php echo $cNewsBlogItem['img']; ?>" alt="<?php echo $cNewsBlogItem['title']; ?>" />