function getSideTrips($location, $limit = 5) { global $wpdb; global $table_prefix; global $thumbdir; global $blogurl; $sql = 'SELECT "" AS thumb, /*SUM(rates.ratings) AS totalRate, */ "" AS ratings, locInfo.*, posts.guid, posts.post_name, posts.post_title, posts.post_content, "thumb" FROM ' . $table_prefix . 'other_info AS locInfo /*INNER JOIN ' . $table_prefix . 'ratings AS rates ON locInfo.post_id = rates.post_id*/ INNER JOIN ' . $table_prefix . 'posts AS posts ON locInfo.post_id = posts.ID '; if (isset($location)) { $sql .= 'WHERE locInfo.location_address LIKe "%' . $location . '%" AND posts.post_status="publish" '; } else { $sql .= 'WHERE posts.post_status="publish" '; } $sql .= 'GROUP BY locInfo.post_id ORDER BY posts.ID DESC /* ORDER BY totalRate DESC*/'; if (isset($limit)) { $sql .= ' LIMIT ' . $limit; } $result = $wpdb->get_results($sql); $finalResult = array(); foreach ($result as $res) { $rating = getPostRatings($res->post_id); $img = getImage($res->post_id); $img = $img->thumb; $img2 = $blogurl . $thumbdir . $img; if (file_exists($img2)) { $img = $thumbdir . $img; } else { $img = "/gray.jpg"; } $res->thumb = $img; $res->ratings = array("total" => $rating->total, "rate" => $rating->overAllRatings); } return $result; }
$catname = "Philippines"; } } $the_query = new WP_Query(array("category__in" => $term_id, "posts_per_page" => 8)); ?> <span class="myriad_pro_bold_condensed sidebarheader"><?php echo $catname; ?> </span> <div class="sidetrip"> <?php if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); $postOtherInfo = getOtherInfo(get_the_id()); $postRating = getPostRatings(get_the_id()); $postImage = getImage(get_the_id(), 1); ?> <div class="sidetripcontent <?php echo $style; ?> "> <div class="leftcont"> <img width="70" height="50" src="/uploads/thumbs/<?php echo $postImage->thumb; ?> " alt="<?php echo get_the_title(); ?> " /> </div>
$the_query = $original_post_query; wp_reset_query(); wp_reset_postdata(); } if ($the_query->have_posts()) { ?> <div> <?php $adcount = 0; while ($the_query->have_posts()) { $the_query->the_post(); $adcount++; $postID = get_the_ID(); $allCat = null; //Get Star Ratings $starComputeFinal = getPostRatings(get_the_ID()); /*Get Special Info*/ $otherInfoData = getOtherInfo(get_the_id()); $imageListing = getImage(get_the_id(), "999"); ?> <div class="searchresultBox"> <div class="searchResultTitle"> <div style="float:left;"> <a href="<?php the_permalink(); ?> " title="Visit <?php echo get_the_title(); ?> "><?php