untested, but try
add_filter( 'bbp_get_view_query_args', 'rew_limit') ;
function rew_limit ($args) {
$args['posts_per_page'] = -1 ;
$args['posts_per_page'= 10 ;
return $args ;
}
not sure which 10 it will show!!
Where shall I put this code? This is what exactly I was looking for :)?
Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
Code Snippets
Okay, I found the functions.php but I confuse about this code add_filter( 'bbp_get_view_query_args', 'rew_limit')
Bc there are functions but there are not any code like this. So Shall I paste this there too? And after paste what’s gonna be shortcut ?
Thank You!
There is one think will be different then this solution. I want to limit topic for [bbp-topic-index] shortcut. You can see the picture.Click for view
amended in the original code to add the missing ;
So how can I edit this code for [bbp-topic-index] shortcut and Implementation to my WordPress plugin? If you please, Can you explain more bc I didn’t understand exactly what to do :/ Sorry.
Thank you for helping
sorry, cab you explain what you want to show in [bbp-topic-index] ? just the first 10 topics ????
Okay, sorry, maybe I didn’t explain well. I have forum for University. Forum is so simple design. We will not have much topics. So I want to limit [bbp-topic-index] shortcut in sidebar with max 3 topics limit. I will share the screen shoot, If you want to see. It can explain better maybe.
Thank you
ScreenShootFromWebsite
you would do better to use the bbpress widget
(bbPress) Recent Topics
which lets you set a number
Yeah, I realize all I need. Thank you a lot. It was so easy π
I would like to show the top 8 most popular topics.
add_filter( 'bbp_get_view_query_args', 'rew_limit') ;
function rew_limit ($args) {
$args['posts_per_page'] = -1 ;
$args['posts_per_page'] = 10 ;
return $args ;
}
Following this, and looking at it: then a bracket ‘]’ might be missing where the (= 10) line is.
Which could explain the unexpected T_FUNCTION error.
Got this code running on my site, (in the functions.php file), and it seems to work.
Happy-hacking.