コード例 #1
0
ファイル: displaylistings.php プロジェクト: altim/kallababy
function displayPagination($locationId, $sectionId, $categoryId, $currentPage)
{
    $numberOfListings = getNumberOfCategorySearchResults($locationId, $sectionId, $categoryId);
    $numberOfPages = ceil($numberOfListings / 12);
    echo '<div class="listing-pagination">';
    echo '<ul>';
    if ($currentPage != 1) {
        echo '<li><a class="prev" href="' . home_url() . '/category-search?location=' . $locationId . '&section=' . $sectionId . '&category=' . $categoryId . '&pagination=' . ($currentPage - 1) . '"><img src="' . get_template_directory_uri() . '/imgs/testimonial-left-arrow.png"></a></li>';
    }
    for ($i = 1; $i < $numberOfPages; $i++) {
        if ($i == $currentPage) {
            echo '<li><a ' . ($i == $currentPage ? 'class="current-page"' : '') . ' >' . $i . '</a></li>';
        } else {
            echo '<li><a ' . ($i == $currentPage ? 'class="current-page"' : '') . ' href="' . home_url() . '/category-search?location=' . $locationId . '&section=' . $sectionId . '&category=' . $categoryId . '&pagination=' . $i . '">' . $i . '</a></li>';
        }
        echo '<li><span>-</span></li>';
    }
    echo '<li><a ' . ($i == $currentPage ? 'class="current-page"' : '') . ' href="' . home_url() . '/category-search?location=' . $locationId . '&section=' . $sectionId . '&category=' . $categoryId . '&pagination=' . $i . '">' . $i . '</a></li>';
    if ($currentPage != $numberOfPages) {
        echo '<li><a class="next" href="' . home_url() . '/category-search?location=' . $locationId . '&section=' . $sectionId . '&category=' . $categoryId . '&pagination=' . ($currentPage + 1) . '"><img src="' . get_template_directory_uri() . '/imgs/testimonial-right-arrow.png"></a></li>';
    }
    echo '</ul>';
    echo '</div>';
}
コード例 #2
0
ファイル: page-listings.php プロジェクト: altim/kallababy
					<?php 
$locationId = $_REQUEST["location"];
$sectionId = $_REQUEST["section"];
$categoryId = $_REQUEST["category"];
$pagination = isset($_REQUEST["pagination"]) ? $_REQUEST["pagination"] : 1;
$offset = ($pagination - 1) * 12;
$categorySeachResults = getCategorySeachResults($locationId, $sectionId, $categoryId, $offset);
$paidListings = array_filter($categorySeachResults, "filter_paid");
$basicListings = array_filter($categorySeachResults, "filter_basic");
shuffle($paidListings);
shuffle($basicListings);
?>


					<h1><?php 
echo getNumberOfCategorySearchResults($locationId, $sectionId, $categoryId);
?>
 <?php 
_e('Results Available', 'kb');
?>
</h1>
					<?php 
if ($mylocale == 'en-CA') {
    ?>
						<p class="breadcrumb"><?php 
    echo getLocById($locationId)["name"];
    ?>
 > <?php 
    echo getSectionById($sectionId)["name"];
    ?>