Automatically Creating Posts for Popular Forum Topics or Products [closed]

I am integrating a WordPress template with Buddypress (with bbPress included).

I would like to automatically create a post for popular forum topics so that it will show in my main page. I am hoping this can be done with popular products as well, with a post title like “Hot Product” etc.

Could someone please tell me if this is possible and how it can be done?

Thanks you so much in advance!

1 Answer
1

I am not familiar with bbpress, but I think that first you need to get the forums in your site and then you need to loop through its topics to obtain the topic that matches your criteria of popular topics. You can search in the docs or source code to find the functions and methods that might help you with that. get_forums() for example might help.

Once you get the popular topic, you will have to fetch the data that you need from it and use this data in constructing the post using wp_insert_post() function. This answer will help building your function and hooking it to the appropriate WP action.

Leave a Comment