开发者

How do i get latest post by category?

currently i am stuck with the problem .my code is

$category_ids = get_all_category_ids();

    foreach($category_ids as $kk=> $cat_id) 开发者_JAVA技巧{

      $cat_name= query_posts( 'posts_per_page=1&orderby=date&order=ASC&cat='.$cat_id);

    if (have_posts ()) :while(have_posts()):the_post

this is the code i write in my loop.php file what i want is to take only latest post by category showing only 1 post of each category by date


You can download a plugin like this and find out how it is done. Also, this thread has something that may help you. It contains a snippet that shows the last post in each of a list of categories. Wold post the code, but it craps up the formatting, sorry.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜