Help with query_posts
-
For a plugin I’m trying to get all the posts and process them. For testing, I’m using a small number but even so I only seem to get one. Any help in correcting this is much appreciated.
Here’s the code (not sure where the white space went):
query_posts('showposts=25&posts_per_page=-1');
if (have_posts()) {
while (have_posts()) {
the_post();
$ttl = htmlspecialchars(the_title('', '', false));
$url = htmlspecialchars(get_permalink());
$aCat = get_the_category();
$cats = "";
foreach($aCat as $cat) {
if($cat->category_parent) {
$cats .= $cat->category_parent."/";
}
$cats .= $cat->cat_name.",";
}
$cats = htmlspecialchars($cats);
$prms = "url=" . $url . "&title=" . $ttl . "&tags=" . $cats;(do something with the prms)
$i++;
}
}
Thanks,
Bill
- The topic ‘Help with query_posts’ is closed to new replies.