Skip to:

Adding a New Thread Link and New Reply link On top of the forums

  • andys27


    I’ve just started using bbpress and I like the simplicity of it. I’ve been trying to customize it to my need for the past 2 weeks (yeah, I am slow). This is something that I came up with that I’d like to share with the community since I’ve learned so much from over here. And I am really proud of myself for coming up with this since I usually suck at php and css.

    If you want a new topic, or new reply button on top of your topics list ore replies list.
    You can just add this code to your functions.php and you are good to go. This way, it will only show a “new topic” link if the user is logged in. If they are not, then it’ll show a text saying “to post a new topic register or login”. Of course, you can change the code to whatever you want. And make sure you change the links to your login and register pages. And you can add class to customize the text with css.

    //function to add new topic thread
    function bbp_login_thread_link() {
    if ( is_user_logged_in() ) { ?>
    <a href="#new-post">Create a new thread</a>
    <?php }
    else { ?>
    <p> To create a new thread <a href="">login</a> or <a href="">register</a></p>
    <?php }
    add_action( 'bbp_template_before_single_forum' , 'bbp_login_thread_link' );
    //function to add new reply thread
    function bbp_post_reply_link() {
    if ( is_user_logged_in() ) { ?>
    <a href="#new-post">Post a Reply</a>
    <?php }
    else { ?>
    <p> To post a reply <a href="http://yourwebsite/login">login</a> or <a href="http://yourwebsite/register">register</a></p>
    <?php }
    add_action( 'bbp_template_before_single_topic' , 'bbp_post_reply_link' );

    I am hoping you guys can add this to this article which has examples of layout and functionality. That article helped me immensely and I will feel honoured to have contributed to it.

Viewing 1 replies (of 1 total)

  • Robkk


    Sorry for the super duper extremely late reply to your post, it was marked as spam and had to be approved by a moderator.

    Thanks for contributing some code to help other users, I will add this to that codex article later today.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar