Pagination on image page
-
Hi all,
I am wondering if you know how to create pagination from this bit of code I am using to display images from bp album+ ? Super stuck, much appreciated for any help.<?php include ( TEMPLATEPATH . '/options-var.php' ); ?> <?php get_header(); //Landscape, People, Panorama, Architecture global $wpdb, $bp; $qp = $wpdb->get_results("SELECT distinct keyword FROM wp_bpm_media_keywords where keyword='landscapes' or keyword='people' or keyword='architecture' or keyword='pets' or keyword='panoramas' or keyword='abstract and fantasy' or keyword='white bird' "); $i=1; $rpr = array(); foreach($qp as $rpres) { $rpr[$i] = $rpres->keyword; $i++; } ?> <div class="imagebank" id="post-entry" style="float: left; width: 970px;"> <h1 class="post-title"><?php echo ucwords($pagename); ?></h1> <div class="post-content" style="position:relative; left:-25px;"> <?php global $bp, $featured_template; $args = array(); // Explicitly creating the array avoids an error in PHP strict mode. ?> <table align="center" cellpadding="0" cellspacing="0" border="1" width="100%"> <?php for($i=1;$i<2;$i++) { ?> <?php if($i%2==1) { ?> <tr class="tbbcss"> <td height="32" class="tbbcss"> <span class="txtgp2"> <?php echo ucfirst($rpr[$i]);?> <span> <br /><br /> <?php // Randomly select results to show from results fetched $qp1 = $wpdb->get_results("SELECT media_id FROM wp_bpm_media_keywords where keyword='".$pagename."'"); $j=0; $args['id']=''; foreach($qp1 as $rpres1) { $args['id'] .=",0,".$rpres1->media_id; $args['max'] = 100; // Total number of results to fetch $args['per_page'] = 100; // Total number of results to show $args['order_key'] = 'top'; } bp_album_featured_query_items($args); // The args we supply to the query will override the values if ( bp_album_featured_has_items() ) : ?> <div class="bpa-content-wrap"> <div class="bpa-content-sitewide"><?php while ( bp_album_featured_has_items() ) : bp_album_featured_the_item(); ?> <a href="<?php bp_album_featured_itemURL() ?>" class="media-image"><?php bp_album_featured_previewImage() ?></a> <?php endwhile; ?> </div> </div><?php endif; ?> <div class="bpa-content-wrap"> <div class="bpa-content-sitewide"><?php $qp1 = $wpdb->get_results("SELECT media_id FROM wp_bpm_media_keywords where keyword='".$rpr[$i]."' order by media_id desc "); foreach($qp1 as $rpres1) { $qp2 = $wpdb->get_results("SELECT preview_image,owner_id FROM wp_bpm_media where id=".$rpres1->media_id); foreach($qp2 as $rpres2) { $url = str_replace("/home/pho/public_html","",$rpres2->preview_image); ?> <?php } ?> </div> </div><?php } ?> </td> <?php } } ?> </tr> </table> </div> </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Pagination on image page’ is closed to new replies.