i'veI have made an sql query that gets several posts according the parameters that i've selected. imI'm showing these posts but the inner paging within wordpress doesnt do anything. itIt shows me that there are more pages but when i select the page number it shows me the same results as before. that That makes sense because it probably runs the sql query again. imI'm using wordpressWordPress and buddypressBuddyPress. how How can i page between these query results?
UPDATE: here is the code im using
$sql = "SELECT post_title, post_date, post_excerpt, guid, ID FROM wp_posts,wp_term_taxonomy, wp_terms, wp_term_relationships WHERE (post_status = 'publish' or post_status = 'inherit') and wp_term_taxonomy.term_taxonomy_id = ".$cat." and wp_posts.ID = wp_term_relationships.object_id and wp_terms.term_id = wp_term_taxonomy.term_taxonomy_id and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id and wp_term_taxonomy.taxonomy = 'category' ORDER by post_date DESC";
$matching_posts = $wpdb->get_results($sql,OBJECT);
<?php if ( have_posts() ) : ?>
<?php foreach ($matching_posts as $post): ?>
<?php setup_postdata($post);
then im showing the info i want like title.