[Plugin: NextGEN Gallery Voting] Need help displaying the top voted images
-
I’m trying to create a function to display the top voted images, but it’s pushing me beyond my php skills. The code below is in my functions.php. It is not returning any errors, but it also isn’t returning the images. I put it together from:
- The db query found in this forum post
- The html to display the images found in the nextgen gallery plugin. (/view/gallery.php lines 38 and following)
My hunch is that I’m close, but like I said, I don’t know php quite well enough to figure out what’s not working right. Appreciate any help getting it right:
function top_images() { global $wpdb; $images = $wpdb->get_results("SELECT pid, SUM(vote) AS totalVote; FROM wp_nggv_votes; GROUP BY pid; ORDER BY totalVote DESC; LIMIT 10;"); foreach($images as $image) { global $wp_query; $wp_query->get_queried_object(); echo "<a href='"; echo $image->imageURL; echo "' title='"; echo $image->description; echo "'"; echo $image->thumbcode; echo "'><img title='"; echo $image->alttext; echo "' alt='"; echo $image->alttext; echo "' src='"; echo $image->thumbnailURL; echo "'"; echo $image->size; echo " /></a>"; } }
- The topic ‘[Plugin: NextGEN Gallery Voting] Need help displaying the top voted images’ is closed to new replies.