Show posts to 2nd author
-
Hello,
I’m trying to show posts to the second assigned author. Currently, the posts only show to the primary author.
I’ve searched the forum and found this code:
?php $user_name = get_the_author_meta(‘user_login’);
$args = array(‘post_type’=>array(‘product’),
‘tax_query’ => array(
array(
‘taxonomy’ => ‘author’,
‘terms’ => $user_name,
‘field’ => ‘name’,
)
),
‘posts_per_page’ => -1, ‘orderby’=> ‘title’, ‘order’ => ‘ASC’);
query_posts($args);
//the loop start here
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?><table style=”width:100%”>
<tr style=”border: none; “>
<th style=”width:18%; border: none;” valign=”top”>
<?php echo the_post_thumbnail(‘thumbnail’); ?>
</th>
<th style=”border: none;”>
“><?php echo the_title();?>
<br><br>
<?php the_excerpt();?>I’m not sure if this should go into a page template, when I did that, I got a blank page.
Thank you in advance for your time!
- The topic ‘Show posts to 2nd author’ is closed to new replies.