从类别数组获取帖子 [英] Getting posts from categories array

查看:77
本文介绍了从类别数组获取帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有某些类别的ID。我想循环一次此类别,最后一次发表3个帖子。我尝试这种方法,但是只能从数组中获取一个类别。

I have some certain categories' ids. I want to loop this categories and last 3 posts in one time. I try this but only come one category from array.

<?php
    $args = array(
    'cat'      => 48,43,49,46,47,44,51,50,42,
    'order'    => 'ASC',
    'showposts' => 3
        );
query_posts($args);
?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>


推荐答案

这段代码不起作用:'cat'=> 48,43,49,46,47,44,51,50,42,

您必须使用数组'cat'=>数组(48,43,49,46,47,44,51,50,42),

这篇关于从类别数组获取帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆