Info
- 14 posts
- 6 voices
- Started 5 years ago by planetphillip
- Latest reply from ardentfrost
- This topic is resolved
Controlling the Number of Latest Discussions
-
- Posted 5 years ago #
Hi,
How can I control the number of latest discussions shown on the frontpage?
I know I can edit the "topics shown on each page" in the config file but I just want a few topics on the frontpage and a different amount for the forums themselves.
TIA
PhillipUPDATE FROM MODERATOR (Feb 12, 2007):
There is now a plugin for this which allows you to specify the number of topics that show up on many of bbPress' pages: -
- Posted 5 years ago #
How about this plugin?
function front_page_topics() {
$bb->page_topics = 10;
}
add_action( 'bb_index.php_pre_db', 'front_page_topics' ); -
- Posted 5 years ago #
I am not sure what you mean by that, as I have never created a plug-in before. Anways, I gave it a try as follows:
Created a blank file with the following content:
<?php
function front_page_topics() {
$bb->page_topics = 2;
}
add_action( 'bb_index.php_pre_db', 'front_page_topics' );?>
Then saved it as "latest-posts.php" and stored it in my newly created "my-plugins" folder.
But it did not seem to have any effect as the front page of the forum would still display more that 2 latest posts (I selected to limit the topics to 2 so it would be asier to test).
The only other thing I can think of is that this code needs to instead be added to one of the regular scripts, but I have no idea which one.
thanks,
thomas
-
- Posted 5 years ago #
Oops, my fault. Do exactly what you did but put
global $bb;directly under the
functionline.<?php
function front_page_topics() {
global $bb;
$bb->page_topics = 2;
}
add_action( 'bb_index.php_pre_db', 'front_page_topics' );?>
-
- Posted 5 years ago #
That works perfectly. Thanks!
-
- Posted 5 years ago #
Works for me too. Thanks to both of you!
NO, wait when I try to open the tags.php I recieve this message:
Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html/forum/my-plugins/latest-topics.php:9) in /home/username/public_html/forum/bb-includes/functions.php on line 1304TIA
-
- Posted 5 years ago #
Make sure there is no whitespace (spaces, extra lines, tabs, etc.) before the
<?phpin your plugin nor after the?> -
- Posted 5 years ago #
Thanks, you were right on the money!
-
- Posted 4 years ago #
Would anyone happen to know if this still applies to version 0.8? I have a new forum I'd like to try this in but I thought I'd check to make sure it wouldn't break anything first. Or is there another method that would work better?
thanks!
-
- Posted 4 years ago #
Looking it over, I can't see any reason why this won't work. I guess test it out and if you get and error, just delete the plugin and report back here!
Trent
-
- Posted 4 years ago #
That version of the plugin should work fine, but the most recent version (Front Page Topics 0.8) is a bit more configurable.
-
- Posted 4 years ago #
I tried it and everything seems to be running smoothly, thanks again for the quick response!
-
- Posted 4 years ago #
Hey, thanks for the tip, mdawaffe. That was a breeze!
-
- Posted 4 years ago #
mdawaffe's plugin isn't as cool as mine
http://bbpress.org/plugins/topic/21?replies=1
j/k about mine being cooler, but it may work in a way that you like better ;)
-
You must log in to post.