示例#1
0
文件: nav.php 项目: bangjojo/wp
function gallery_nav_btns($page_num, $max_num_pages, $search = 0)
{
    if ($page_num == '' && $page_num == 0) {
        $page_num = '1';
    }
    if ($max_num_pages > 1) {
        ?>
			<table>
				<tr>
					<td> 
						<a class="previous" href="<?php 
        if ($page_num > 1) {
            $new_page = $page_num - 1;
        } else {
            $new_page = 1;
        }
        echo custom_nav_btn_links($search, $new_page);
        ?>
"><span> <?php 
        printf(__('Previous', 'bordeaux'));
        ?>
</span></a>
						<?php 
        if ($page_num < 4 or $max_num_pages < 8) {
            $start = 1;
            if ($max_num_pages >= 7) {
                $end = 7;
            } else {
                $end = $max_num_pages;
            }
        } else {
            if ($page_num + 3 > $max_num_pages) {
                $end = $max_num_pages;
                $start = $end - 7;
            } else {
                $start = $page_num - 3;
                $end = $page_num + 3;
            }
        }
        for ($i = $start; $i <= $end; $i++) {
            ?>
<a <?php 
            if ($i == $page_num) {
                ?>
 class="active" <?php 
            }
            ?>
 href="<?php 
            echo custom_nav_btn_links($search, $i);
            ?>
"><span><?php 
            echo $i;
            ?>
</span></a><?php 
        }
        ?>
						<a class="next" href="<?php 
        if ($page_num < $max_num_pages) {
            $new_page = $page_num + 1;
        } else {
            $new_page = $page_num;
        }
        echo custom_nav_btn_links($search, $new_page);
        ?>
"><span><?php 
        printf(__('Next', 'bordeaux'));
        ?>
 </span></a>
					</td>
				</tr>
			</table>
		<?php 
    }
}
示例#2
0
function gallery_nav_btns($page_num, $max_num_pages, $search = 0)
{
    if ($page_num == '' && $page_num == 0) {
        $page_num = '1';
    }
    ?>
		<div class="gallery-navi">
					
			<?php 
    if ($page_num > 1) {
        ?>
						<?php 
        if ($page_num < 4 or $max_num_pages < 8) {
            $start = 1;
            if ($max_num_pages >= 7) {
                $end = 7;
            } else {
                $end = $max_num_pages;
            }
        } else {
            if ($page_num + 3 > $max_num_pages) {
                $end = $max_num_pages;
                $start = $end - 7;
            } else {
                $start = $page_num - 3;
                $end = $page_num + 3;
            }
        }
        for ($i = $start; $i <= $end; $i++) {
            ?>
<!--<a <?php 
            if ($i == $page_num) {
                ?>
 class="active" <?php 
            } else {
                ?>
 class="default" <?php 
            }
            ?>
 href="<?php 
            echo custom_nav_btn_links($search, $i);
            ?>
"><span><?php 
            echo $i;
            ?>
</span></a>--><?php 
        }
        ?>
						
						<a href="<?php 
        if ($page_num < $max_num_pages) {
            $new_page = $page_num + 1;
        } else {
            $new_page = $page_num;
        }
        echo custom_nav_btn_links($search, $new_page);
        ?>
" class="next"> </a>
						<!--<a href="<?php 
        if ($page_num > 1) {
            $new_page = $page_num - 1;
        } else {
            $new_page = 1;
        }
        echo custom_nav_btn_links($search, $new_page);
        ?>
" class="prev"><?php 
        printf(__('Previous', THEME_NAME));
        ?>
</a>-->
			<?php 
    } else {
        ?>
						<a href="<?php 
        echo custom_nav_btn_links($search, 2);
        ?>
" class="next"> </a>
			<?php 
    }
    ?>
		</div>
		<?php 
}