Commit 7ec81660 by Muhammad Usman

pagination links added

parent b57601c3
......@@ -6,96 +6,81 @@ Template Name: Blog Page
<?php get_header(); ?>
<div class="container">
<div class="row">
<div class="col-sm-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="<?php echo site_url(); ?>"><?php echo get_the_title( get_option('page_on_front') ) ?></a></li>
<li class="breadcrumb-item active" aria-current="page"><?php echo REVIEWS_PAGE ?></li>
</ol>
</nav>
</div>
<div class="col-sm-8">
<div class="container">
<div class="row">
<div class="col-sm-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a
href="<?php echo site_url(); ?>"><?php echo get_the_title( get_option( 'page_on_front' ) ) ?></a>
</li>
<li class="breadcrumb-item active" aria-current="page"><?php echo REVIEWS_PAGE ?></li>
</ol>
</nav>
</div>
<div class="col-sm-8">
<div class="row">
<div class="row">
<?php
$page = isset($_GET['page']) ? $_GET['page'] : 1;
<?php
$loop = new WP_Query( array( 'post_type' => 'hosting_reviews', 'paged' => true, 'posts_per_page' => 2 ) );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
$loop = new WP_Query( array( 'post_type' => 'hosting_reviews',
'paged' => $page,
'posts_per_page' => 10
) );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-sm-12">
<img class="blogImage" src="<?php echo get_the_post_thumbnail_url();?>">
<img class="blogImage" src="<?php echo get_the_post_thumbnail_url(); ?>">
<div class="blogSingle">
<a href="<?php the_permalink(); ?>"><h3><?php the_title(); ?> </h3></a>
</div>
<div class="d-flex spaceBetween">
<div class="singleBox r-margin">
<img class="userIcon" src="<?php echo get_template_directory_uri(); ?>/assets/images/user-icon.png">
<img class="userIcon"
src="<?php echo get_template_directory_uri(); ?>/assets/images/user-icon.png">
<div class="blogSingle d-inline-block">
<h5><?php echo get_the_author_meta('display_name'); ?> </h5>
<h5><?php echo get_the_author_meta( 'display_name' ); ?> </h5>
</div>
</div>
<div class="singleBox">
<img class="userIcon" src="<?php echo get_template_directory_uri(); ?>/assets/images/date-icon.png">
<img class="userIcon"
src="<?php echo get_template_directory_uri(); ?>/assets/images/date-icon.png">
<div class="blogSingle d-inline-block">
<h5><?php the_time('F j, Y'); ?></h5>
<h5><?php the_time( 'F j, Y' ); ?></h5>
</div>
</div>
</div>
</div>
<?php endwhile;
if ( $loop->max_num_pages > 1 ) : ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Previous', 'domain' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Next <span class="meta-nav">&rarr;</span>', 'domain' ) ); ?></div>
</div>
<?php endif;
endif;
wp_reset_postdata();
?>
<?php endwhile;
endif;
?>
<div class="pagination d-flex justify-content-center w-100">
<?php
$page = isset($_GET['page']) ? $_GET['page'] : 1;
echo paginate_links( array(
'current' => $page,
'format' => '?page=%#%',
'prev_text' => '«',
'next_text' => '»',
'total' => $loop->max_num_pages
) );
?>
</div>
</div>
</div>
<div class="ppage">
<?php
global $wp_query;
paginate_links();
?>
</div>
<div class="col-md-4">
<div class="d-flex j-content-center">
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li class="page-item"><a class="page-link" href="#">01</a></li>
<li class="page-item"><a class="page-link" href="#">02</a></li>
<li class="page-item"><a class="page-link" href="#">03</a></li>
<li class="page-item"><a class="page-link" href="#">04</a></li>
<li class="page-item"><a class="page-link" href="#">05</a></li>
<li class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
<div class="col-md-4">
<?php get_sidebar(); ?>
<?php get_sidebar(); ?>
</div>
</div>
</div>
</div>
<?php
......
......@@ -2953,7 +2953,16 @@ h2 span
/*----- Media Query Style End {320px} ----- */
.page-numbers {
position: relative;
display: block;
padding: .5rem .75rem;
margin-left: -1px;
line-height: 1.25;
color: #007bff;
background-color: #fff;
border: 1px solid #dee2e6;
}
.loader {
border: 8px solid #f3f3f3;
......
......@@ -21,8 +21,10 @@ Template Name: Blog Page
<?php
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$the_query = new WP_Query(array(
'posts_per_page' => 10
'posts_per_page' => 10,
'paged' => $page
));
if ( $the_query->have_posts() ) :
......@@ -50,34 +52,25 @@ Template Name: Blog Page
?>
<div class="pagination d-flex justify-content-center w-100">
<?php
$page = isset($_GET['page']) ? $_GET['page'] : 1;
echo paginate_links( array(
'current' => $page,
'format' => '?page=%#%',
'prev_text' => '«',
'next_text' => '»',
'total' => $the_query->max_num_pages
) );
?>
</div>
<?php
endif;
?>
</div>
<div class="d-flex j-content-center">
<nav aria-label="Page navigation example">
<ul class="pagination">
<li class="page-item">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li class="page-item"><a class="page-link" href="#">01</a></li>
<li class="page-item"><a class="page-link" href="#">02</a></li>
<li class="page-item"><a class="page-link" href="#">03</a></li>
<li class="page-item"><a class="page-link" href="#">04</a></li>
<li class="page-item"><a class="page-link" href="#">05</a></li>
<li class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
<div class="col-md-4">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment