当生成网站的首页并尝试从 wordpress 数据库中获取五个摘录时,它会生成摘录,没问题,但它完全忽略了我的 the_title、get_the_id 和 the_date:
foreach( $post as $posts) : setup_postdata($posts);
echo "<hr><h1>" . the_title( false, false, false ) . "</h1>";
echo the_excerpt( ) . "<br />";
echo "<a href='./index.php?p=" . get_the_ID( ) . "'><font color='white'>Read More...</font></a><br />";
echo "Published on: " . the_date( false, false, false, false );
endforeach;
产生输出:
http://i.stack.imgur.com/JNkxh.png
因此,“阅读更多...”被定向到“./index.php?p=”
我已将 get_posts 语句定义如下:
$args = array(
'posts_per_page' => 5,
'numberposts' => 5,
'offset' => 0,
'category' => $c,
'order_by' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_mime_type' => '',
'post_parent' => '',
'post_status' => 'publish',
'suppress_filters' => true );
$post = get_posts( $args );
任何关于出了什么问题的想法将不胜感激。