On a website, I have 4 article authors. I want to display each author's posts on his own custom post page.
I have come up with this piece of code:
<ul class="author-posts"> <?php $catquery = new WP_Query( 'cat=7&posts_per_page=30&order=DESC&author_name=john' ); while($catquery->have_posts()) : $catquery->the_post(); ?> <li class="author-post"><?php the_content();?></li> <?php endwhile;?>
The problem with the code above is that only one author's name is john.
So the WP_Query does not display terry's posts.
If every parent page (actually, a custom post) has an author, how do I store the parent page's author in a variable so that I can show on it only the posts belonging to the current author?