Forum
Next/Prev buttons still not working correctly
Sorry I thought it was working so I marked my previous thread as solved but it's still not working.
I have 4 test blog pages but on every post the next and previous links are linking to the 2nd and 4th page. I'm assuming there is something wrong with the first part that checks for what post its on but I can't figure it out.
<?php
$result = perch_blog_custom(array(
'sort'=>'postDateTime',
'section' => 'comic-pages',
'sort-order'=>'ASC',
'value' => $result[0]['postDateTime'],
'template'=>'blog/post_comic_page_prev.html',
'count'=>1,
'skip-template' => true,
'return-html' => true,
));
PerchSystem::set_var('is_prev', true);
perch_blog_custom(array(
'template' => 'blog/post_comic_page_prev.html',
'filter' => 'postDateTime',
'section' => 'comic-pages',
'match' => 'gt',
'value' => $result[0]['postDateTime'],
'sort' => 'postDateTime',
'sort-order' => 'ASC',
'count' => 1,
));
echo $result['html'];
?>
<?php
$result = perch_blog_custom(array(
'sort'=>'postDateTime',
'section' => 'comic-pages',
'sort-order'=>'DESC',
'value' => $result[0]['postDateTime'],
'template'=>'blog/post_comic_page_next.html',
'count'=>1,
'skip-template' => true,
'return-html' => true,
));
PerchSystem::set_var('is_next', true);
perch_blog_custom(array(
'template' => 'blog/post_comic_page_next.html',
'filter' => 'postDateTime',
'section' => 'comic-pages',
'match' => 'lt',
'value' => $result[0]['postDateTime'],
'sort' => 'postDateTime',
'sort-order' => 'DESC',
'count' => 1,
));
echo $result['html'];
?>
Hi Jana, I am not sure this is possible in the blog. I think this functionality might be only possible on list and details pages.
Get the current post and store it in
$result
:To show the post:
To show the previous link (the date of the post is less than the date of the current post):
To show the next link (the date of the post is greater than the date of the current post):
Yay I got there. Thanks so much for your patience and assistance