$lastPage) { // if it is greater than $lastpage
$pn = $lastPage; // force it to be $lastpage's value
}
$centerPages = "";
$sub1 = $pn - 1;
$sub2 = $pn - 2;
$add1 = $pn + 1;
$add2 = $pn + 2;
if ($pn == 1) {
$centerPages .= '
' . $pn . '';
$centerPages .= '
' . $add1 . '';
} else if ($pn == $lastPage) {
$centerPages .= '
' . $sub1 . '';
$centerPages .= '
' . $pn . '';
} else if ($pn > 2 && $pn < ($lastPage - 1)) {
$centerPages .= '
' . $sub2 . '';
$centerPages .= '
' . $sub1 . '';
$centerPages .= '
' . $pn . '';
$centerPages .= '
' . $add1 . '';
$centerPages .= '
' . $add2 . '';
} else if ($pn > 1 && $pn < $lastPage) {
$centerPages .= '
' . $sub1 . ' ';
$centerPages .= '
' . $pn . '';
$centerPages .= '
' . $add1 . '';
}
$limit = 'LIMIT ' . ($pn - 1) * $itemsPerPage . ',' . $itemsPerPage;
$paginationDisplay = "
"; // Initialize the pagination output variable
if ($lastPage != "1") {
//$paginationDisplay .= 'Page ' . $pn . ' of ' . $lastPage . ' ';
if ($pn != 1) {
$previous = $pn - 1;
$paginationDisplay .= '- «
';
}
$paginationDisplay .= $centerPages;
if ($pn != $lastPage) {
$nextPage = $pn + 1;
$paginationDisplay .= '- »
';
}
}
$paginationDisplay .= '
';
if($pn < 1){
$paginationDisplay = '';
}
$results = gc_multi_search($sfrom, $location, $limit);
if ($results['result']) {
foreach ($results['result'] as $q) {
$featured_class = '';
$is_pro = get_post_meta($q->ID, 'geocraft_listing_type', true);
if ($is_pro == 'pro') {
$featured_class = 'featured';
}
$img_meta = get_post_meta($q->ID, 'geocraft_meta_image1', true);
?>
ID)); ?>
ID,N_RV, _RV, '% ' . REVIEW); ?>
ID, 'geo_address', true)): ?>
ID, 'geo_address', true); ?>
]+\>/i", "", $q->post_content);
$excerpt = substr(strip_tags($excerpt), 0, 111);
printf("%s", $excerpt);
if (strlen($excerpt) > 110)
echo '
' . '[...] Read More' . '';
?>