Tagged: x3ume5s insurance
For those members who use bbpress and want to add a “new topic” button, I have hunted/searched/asked all over the internet and I’ve finally come up with a solution with some help of coders at WPMUDEV and here it is:
In loop-fourms.php file add your custom “Add Topic” button:
<a href="/new-topic/?ForumId=<?php echo bbp_get_forum_id()?>">New Topic</a>
Add this code to a custom .php file or directly to your theme function.php file:
//BBpress New Topic Button // add_shortcode('wpmu_bbp_topic', 'wpmu_bbp_create_new_topic', 10); function wpmu_bbp_create_new_topic(){ if ( isset($_GET['ForumId']) ){ return do_shortcode("[bbp-topic-form forum_id=".$_GET['ForumId']."]"); }else{ return do_shortcode("[bbp-topic-form]"); } } //End BBpress New Topic Button //
Make sure you’ve created a custom page titled “new topic” with a friendly url of “new-topic”
Place the new shortcode we registered into this page:
[wpmu_bbp_topic]
This will automatically display contact create form of the selected forum if ID exists in the URL otherwise fall back to default shortcode.
You can see it in action on my site:
http://artofwargaming.net/forums/Hope this helps anyone who was looking to create a “new topic” button.
I can’t take credit for this, this was all thanks to the help of the guys over at WPMUDEV – Sajid, Anang, and Tyler.
Hi Joshua,
Welcome to the BuddyDev forums 🙂Thank you for sharing the code, I am sure may community members will find it useful.
I highly appreciate sharing the knowledge 🙂Thank you
Brajesh
You must be logged in to reply to this topic.