Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to restrict number of Latest Discussions on front page


_ck_
Participant

@_ck_

Front page topics plugin isn’t working? Hmm. Should be.

I have a modification I’ve done somewhere…

Try this:

// fix number of front page topics
function bb_custom_topic_limit($limit) {
switch (bb_get_location()) :
case 'front-page': $limit=5; break;
case 'forum-page': $limit=10; break;
case 'tag-page': break;
case 'topic-page': $limit=15; break;
case 'feed-page': break;
case 'search-page': break;
case 'profile-page': break;
case 'favorites-page': break;
case 'view-page': $limit=10; break;
case 'stats-page': break;
case 'login-page': break;
default: $limit=15;
endswitch;
return $limit;
}
add_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit',200);

// required to fix for custom topic limits to calculate correct page jumps
function fix_post_link ($link,$post_id) {
global $topic;
remove_action( 'bb_get_option_page_topics', 'bb_custom_topic_limit' );
if ($topic && $topic->topic_last_post_id==$post_id) {
$topic_id=$topic->topic_id;
$page=get_page_number( $topic->topic_posts );
} else {
$bb_post = bb_get_post( get_post_id( $post_id ) );
$topic_id=$bb_post->topic_id;
$page = get_page_number( $bb_post->post_position );
}
return get_topic_link( $topic_id, $page ) . "#post-$post_id";
}
add_filter( 'get_post_link','fix_post_link',10, 2);

Skip to toolbar