A further change I have made on my weblog (News Manager) at https://www.perpetual-beta.org/ is to have proper previous and next buttons at the end of each post, in place of the JavaScript "back" link that the News Manager uses by default.
In the file /plugins/news_manager/inc/site.php, find the function called "nm_show_post" and replace the following:
with:
Have fun!
In the file /plugins/news_manager/inc/site.php, find the function called "nm_show_post" and replace the following:
Code:
# show "go back" link, if required
if (strstr($_SERVER['QUERY_STRING'], "post=$slug")) {
echo '<p class="nm_post_back"><a href="javascript:history.back()"><< ';
i18n('news_manager/GO_BACK');
echo '</a></p>';
}
with:
Code:
// BOF: Previous & Next article links
if ( !$excerpt && ($post->private != 'Y') ) {
echo '<div id="pagerBottom">';
$articleIndex = nm_get_posts();
$articleDirectory = array();
foreach ($articleIndex as $article) $articleDirectory[strtotime($article->date)] = $article->title . '|' . nm_get_url('post') . $article->slug;
unset($articleIndex);
ksort($articleDirectory);
$current = strtotime($post->date);
reset($articleDirectory);
while (key($articleDirectory) !== $current) next($articleDirectory);
prev($articleDirectory);
$previous = key($articleDirectory);
if ( ($previous !== $current) && $previous ) {
$prevTemp = explode('|', $articleDirectory[$previous]);
echo '<div class="prevLink"><a href="' . $prevTemp[1] . '" title="read: ' . $prevTemp[0] . ' (dated: ' . date('l jS \of F Y h:i:s A', $previous) . ')"><span class="button">← Previous Post</span></a></div>';
next($articleDirectory);
} elseif (!$previous) {
reset($articleDirectory);
}
next($articleDirectory);
$next = key($articleDirectory);
if ( ($next !== $current) && $next ){
$nextTemp = explode('|', $articleDirectory[$next]);
echo '<div class="nextLink"><a href="' . $nextTemp[1] . '" title="read: ' . $nextTemp[0] . ' (dated: ' . date('l jS \of F Y h:i:s A', $next) . ')"><span class="button">Next Post →</span></a></div>';
}
unset($articleDirectory);
echo '</div>';
}
// EOF: Previous & Next article links
Have fun!