Tomer Lichtash
Tomer Lichtash

Reputation: 9252

Need help with MySQL query for Wordpress

My problem is not with Wordpress's WPDB class, but with the MySQL syntax. I'm trying make the following sequence work:

Help? Thank you.

Upvotes: 0

Views: 127

Answers (1)

robertbasic
robertbasic

Reputation: 4335

Use query_posts function for that http://codex.wordpress.org/Template_Tags/query_posts by passing the category id or the category name to it. It's all explained on the link.

Edit after your comments:

You can use get_posts http://codex.wordpress.org/Template_Tags/get_posts, too, AFAIK they both return arrays.

$posts = get_posts('category=1');
foreach($posts as $post) {
    echo $post->ID; // or whatever you want to do with it...
}

Upvotes: 2

Related Questions