Hi sorry, I didn’t get a notice that someone had replied.
I actually inherited this website project so I’m not sure how it really works. Far as I can tell, the original designer created standalone templates instead of applying the pagination directly into the theme. That or he did it correctly and I’m just not understanding how it works.
For the time being I hard coded the results we wanted at the bottom, but could you take a look at the code and see what might be wrong?
<?php
/* Template Name: Talk Story*/
?>
<?php
get_header();
?>
<div id="container">
<div class="page_title">
<?php if ( has_post_thumbnail()) : ?>
<?php the_post_thumbnail('page_image'); ?>
<?php endif; ?>
<?php the_title(); ?>
</div>
<div id="masseges-educate">
<?php
$short_message = get_post_meta($post->ID, 'short_message', true);
if($short_message){
?>
<?php echo $short_message; ?>
<?php } ?>
</div>
<?php
global $paged;
$curpage = $paged ? $paged : 1;
$loop = new WP_Query( array(
'category_name'=>'talk_story',
'post_type' => 'post',
'paged' => $paged,
'posts_per_page' => 15,
'orderby' => 'date',
'order' => 'ASC' ) );
?>
<div id="talk_story">
<ul>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li>
<div class="story_photo">
<?php the_post_thumbnail('feature-thumbnail'); ?>
</div>
<div class="arrow2"></div>
<div class="sub_container">
<h1><?php the_title(); ?></h1>
<div class="post-subtitle">
<?php
$short_message = get_post_meta($post->ID, 'heading_message', true);
if($short_message){
?>
<?php echo $short_message; ?>
<?php } ?>
</div>
<?php the_excerpt(); ?>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php echo '
<div id="blog_listining_pagianation">
<a class="first page button" href="'.get_pagenum_link(1).'">«</a>
<a class="previous page button" href="'.get_pagenum_link(($curpage-1 > 0 ? $curpage-1 : 1)).'">prev.page</a><div class=no_of_pages> <span>'.$curpage.'</span> of <span> '.$paged.' </span> Pages </div>';
for($i=1;$i<=$loop->max_num_pages;$i++)
echo '<a class="'.($i == $curpage ? 'active ' : '').'page button" href="'.get_pagenum_link($i).'">'.$i.'</a>';
echo '
<a class="next page button" href="'.get_pagenum_link(($curpage+1 <= $loop->max_num_pages ? $curpage+1 : $loop->max_num_pages)).'">next page</a>
<a class="last page button" href="'.get_pagenum_link($loop->max_num_pages).'">»</a>
</div>
';
wp_reset_postdata();
?>
<?php get_footer(); ?>
In the live site, I have hard coded the ‘.$paged.’ into the correct number, but that is obviously not ideal.