PHP显示当前页面作者的WordPress帖子列表
我不是一个专业的程序员,但有时我做得很好;)也就是说,我正在尝试创建一些php代码来获取当前作者,然后显示来自类别x的WordPress帖子列表 此代码可以工作,但是静态的:PHP显示当前页面作者的WordPress帖子列表,php,wordpress,Php,Wordpress,我不是一个专业的程序员,但有时我做得很好;)也就是说,我正在尝试创建一些php代码来获取当前作者,然后显示来自类别x的WordPress帖子列表 此代码可以工作,但是静态的: <?php query_posts('cat=665&author=37&order=ASC&showposts=-1'); ?> <?php if(have_posts()) : while(have_posts()) : the_post(); ?> <a hre
<?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; ?>
更改
$t = 'cat=666&author=' . $author_ID . '&order=ASC&showposts=1';
到
如果可以的话,我还要问你一个问题。我如何才能将此更改为最多只显示10篇帖子?谢谢!
$t = 'cat=666&author=' . $author_ID . '&order=ASC&showposts=-1';