Adding topic tag filter in recent topics widget
-
I wanted to filter the recent forum topics not only by their parent forum but also by their topic tags.
I fiddled with the widgets.php that I found at wp-content/plugins/bbpress/includes/common/.
I’m not a programmer yet I achieved the widget interface to contain the field for topic tag.
Though it looks good, its not working. The topics are not filtered by the desired topic tag. In fact, it is not making any difference.
I think the problem is about not getting the field ID for the topic tag. Or, there isn’t any filter for sorting topic tags.
I searched the entire BBPress support forums but did not find any similar post or problem.
I wish to know is it right to use the following:
$instance['topic_tag'] = sanitize_text_field( $new_instance['topic_tag'] );
get_field_name( 'topic_tag' );
Should I use –
'post_topic_tag' => $settings['topic_tag'],
or
'post_topic_tag' => bbp_get_topic_tag_tax_id(),
I came across a somewhat related topic https://bbpress.org/forums/topic/topic-tag-archive-wrongly-displaying-all-topics/
It suggests to use this –
if( bbp_has_topics( array( bbp_get_topic_tag_tax_id() => bbp_get_topic_tag_slug() ) ) )
Now, I’ve tried all of these and I’m getting nowhere.
I hope the experts here will spot out the problem and help me sort out my widget in the way I want.
Thanks.
-
I think I need to be specific and make clear that my question is – what changes should I make to the widgets.php in order to achieve my aim?
And, do I have to make changes in any other file too?
Thanks.
Can anyone help in customizing the recent topics widget by adding a “topic tags” filter?
Or is there any other way to filter posts on the basis of topic tags?
Thanks.
you can create a new widget based off of the default recent topics widget and customize it to your liking. or you can edit this
https://wordpress.org/plugins/bbpress-advanced-recent-topics-widget/
and add the topic tag thing you want.
Anybody looking for a solution to similar need, use this plugin – https://wordpress.org/plugins/posts-in-sidebar/
- You must be logged in to reply to this topic.