【发布时间】:2016-02-26 03:58:00
【问题描述】:
我不是专业编码员,但有时我做得很好;)话虽如此,我正在尝试创建一些 php 代码来获取当前作者,然后显示来自类别 x 的 WordPress 帖子列表。
此代码有效,但是是静态的:
<?php query_posts('cat=665&author=37&order=ASC&showposts=-1'); ?>
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
<?php endwhile; endif; ?> code here
这段代码很好用。它显示 3 个帖子。
所以我创建了这个代码来根据页面的作者来制作作者。它有效,但只显示一篇文章。它在 1 之后停止... :( 知道为什么吗?
<?php
$author_ID = get_query_var('author');
$t = 'cat=666&author=' . $author_ID . '&order=ASC&showposts=1';
query_posts($t);
if(have_posts()) : while(have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>
<?php endwhile; endif; ?>
【问题讨论】: