WordPress.org

Ready to get started?Download WordPress

Forums

Help with query_posts (1 post)

  1. billsaysthis
    Member
    Posted 7 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic