Make new wordpress loop using query_posts
by Rekha[ Edit ] 2013-06-29 22:51:10
<h1>query_posts :</h1> This function can be used to:
Revise the query that WordPress forms from the URL, so you can change the sorting of posts, exclude certain categories, etc.
query_posts($query_string . "&category_name=News");
This takes the current query and sorts it in ascending order, limiting the results to posts in the "News" category.
Create custom queries in administration plugins.
query_posts(array(
"category__in" => array(1,3),
"posts_per_page" => -1,
"author" => 5
));
This query grabs all the posts by author 5 in categories 1 or 3.
After calling query_posts, you can use your standard WordPress loop, along with all the template tags it makes available, in your template or plugin.