admin管理员组文章数量:1305115
I’m doing a site where all the posts are set to have a future date, and are published via a WP_Query
. I know that this is somewhat going against the whole idea of how future-scheduled posts work, but that’s how this site has been set up.
As part of the site, I want to be able to have author pages for each post author, showing the posts that they have written — the fairly standard author.php
type of archive.
At the moment, a standard loop won’t show the author’s posts, because they’re all dated in the future. So I’m trying to set up another WP_Query
that will show all the posts by a given author. Here’s what I just tried to use:
<?php /* begin wp_query */
$the_query = new WP_Query(
array(
'category_name' => 'events',
'post_status' => array(future, publish),
'author' => $curauth->ID
)
);
if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<p>Event: <strong><?php the_title(); ?></strong></p>
<?php endwhile; wp_reset_postdata(); else : __('Nope'); endif; /* end wp_query */ ?>
However, the problem here is that this is outputting a list of every single post on the whole site, by all authors — not just by whichever author’s page I’m on.
So — how do I get it to just show the posts by the given author, and not every post at once?
Thanks...
本文标签:
版权声明:本文标题:wp query - How can I display list of all posts from a specific author, with publish dates in the future, on an author archive pa 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741794617a2397863.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论