Skip to:
Content
Pages
Categories
Search
Top
Bottom

How To Add “New Topic” button


  • erich199
    Participant

    @erich199

    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.

Viewing 5 replies - 1 through 5 (of 5 total)

  • sundev
    Participant

    @sundev

    Thanks for this.

    Please how can I locate “loop-fourms.php” ?


    erich199
    Participant

    @erich199

    @sundev

    It should be located in
    /wp-content/plugins/bbpress/templates/default/bbpress/

    After you copy this file, create a new folder inside of your current theme folder and call it “bbpress”

    Place that forum-loop.php file inside of that folder.

    Make your changes to that file.


    sundev
    Participant

    @sundev

    Oh! gratitude @erich199.

    I clicked Forums nav in member profile, Under Forum Topics Started it displays notification: “You have not created any topics.”

    I would like to put the “Start a topic” button immediately after the notification.

    Please, do know how can I achieve this as well ?


    erich199
    Participant

    @erich199

    Hi @sundev,

    Not sure about that one. Perhaps someone else will see this and can help with that? I’m sure it will be very similar to adding the “New Topic” button.


    sundev
    Participant

    @sundev

    Thanks for the reply, apologise for my typos above.

    I guess so too, it will be similar.

    Nevertheless, I follow your step above, the link to new-topic works perfectly but the button did not show up on the forums heaher! I am Still trying to find I trying found

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How To Add “New Topic” button’ is closed to new replies.
Skip to toolbar