Page ce mois-ci (pagination ajax 1)

https://www.sanwebe.com/2013/03/ajax-pagination-with-jquery-php
This commit is contained in:
2016-12-27 06:22:34 +01:00
parent c7cc884ea6
commit 1fa1f61d0e
12 changed files with 1631 additions and 4 deletions

96
header.php Executable file
View File

@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php wp_head(); ?>
<script type="text/javascript">
$(document).ready(function() {
var fetch = '<?php echo get_stylesheet_directory_uri() . "/fetch_pages.php" ?>'
$("#results" ).load( fetch ); //load initial records
// $_SERVER['REQUEST_URI']
//executes code below when user click on pagination links
$("#results").on( "click", ".pagination a", function (e){
e.preventDefault();
$(".loading-div").show(); //show loading element
var page = $(this).attr("data-page"); //get page number from link
$("#results").load( fetch ,{"page":page}, function(){ //get content from PHP page
$(".loading-div").hide(); //once done, hide loading element
});
});
});
</script>
<style type="text/css">
/*found on http://www.brunildo.org/test/img_center.html*/
.wraptocenter {
display: table-cell!important;
text-align: center!important;
vertical-align: middle!important;
width: 200px;
height: 200px;
}
.wraptocenter * {
vertical-align: middle!important;
}
/*\*//*/
.wraptocenter {
display: block;
}
.wraptocenter span {
display: inline-block;
height: 100%;
width: 1px;
}
/**/
</style>
<!--[if IE]><style>
.wraptocenter span {
display: inline-block;
height: 100%;
}
</style><![endif]-->
</head>
<body <?php body_class(); ?>>
<header id="head">
<div class="top-area">
<div class="container">
<div class="head-details">
<?php
echo (dess_setting('dess_tel') != '' ? __('Tel: ','creator').'<a href="tel:'.dess_setting('dess_tel').'">'. dess_setting('dess_tel').'</a>' : '');
echo (dess_setting('dess_email') != '' ? ' | '.__('Email: ','creator').'<a href="mailto:'.dess_setting('dess_email').'">'. dess_setting('dess_email').'</a>' : '');
echo (dess_setting('dess_hoursup') != '' ? ' | '.dess_setting('dess_hoursup') : '');
?>
</div><!-- head-details -->
<div class="head-socials">
<ul>
<?php
$socials = array('twitter','facebook','google-plus','instagram','pinterest','vimeo','youtube','linkedin');
for($i=0;$i<count($socials);$i++){
$url = '';
$s = $socials[$i];
$url = dess_setting('dess_'.$s);
echo ($url != '' ? '<li><a target="_blank" href="'.$url.'"><img src="'.esc_url( get_stylesheet_directory_uri() ).'/images/'.$s.'-icon.png" alt="'.$s.'" /></a></li>':'');
}
?>
</ul>
</div><!-- head-socials -->
<div class="clear"></div>
</div><!-- container -->
</div><!-- top-area -->
<div class="head-area">
<div class="container">
<div class="logo">
<?php echo (dess_setting('dess_logo') != '' ? '<a href="'.home_url().'"><img src="'.dess_setting('dess_logo').'" alt="logo" /></a>': '<a href="'.home_url().'"><img src="'.esc_url( get_stylesheet_directory_uri() ).'/images/logo.png" alt="logo" /></a>'); ?>
</div><!-- logo -->
<div class="head-nav">
<?php wp_nav_menu(array('theme_location' => 'header-menu')); ?>
</div><!-- head-nav -->
<div class="clear"></div>
</div><!-- container -->
</div><!-- head-area -->
</header>