Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Anyone have Prev/Next Thread / Forum plugin?


fel64
Member

@fel64

There is now!

Save this in a file, call it sumting.php, and drop it into your my-plugins folder. Then put <?php feltopicnav(); ?> somewhere in a topic template. Not tested, so please tell me if it works. :)

<?php
/*
Plugin Name: Topic Navs;
Plugin URI:
Description: Put <?php feltopicnav(); ?> in a topic template to show links to the previous and next topics. Optional parameters are $nexttext, $prevtext, $betweentext and $lastpost.
Author: fel64
Version: 0.7
Author URI: http://www.loinhead.net/
*/

function feltopicnav( $nexttext = '', $prevtext = '', $betweentext = ' ', $lastpost = true )
{
global $topic_id;
$nexttopic = $topic_id + 1;
$prevtopic = $topic_id - 1;
if( !$nexttext )
$nexttext = topic_title( $nexttopic );
if( !$prevtext )
$prevtext = topic_title( $prevtopic );
if( $lastpost ) {
$nextlink = topic_last_post_link( $nexttopic );
$prevlink = topic_last_post_link( $prevtopic );
} else {
$nextlink = topic_link( $nexttopic );
$prevlink = topic_link( $prevtopic );
}
echo '<a href="' . $prevlink . '">' . $prevtext . '</a>' . $betweentext . '<a href="' . $nextlink . '">' . $nexttext . '</a>';
}
?>

Skip to toolbar