Skip to:
Content
Pages
Categories
Search
Top
Bottom

Is there a way to specify a loop template in threaded replies?


  • Kineta
    Participant

    @kineta

    I’m trying to make a modified version of the bbp_list_replies() function used in threaded replies (I want to make a threaded index with just titles, authors, and post links). I see that the function uses the BBP_Walker_Reply class which calls bbp_get_template_part( ‘loop’, ‘single-reply’ );

    Is there any way to call a different template? Maybe through the $args array?

    Or would it make more sense to somehow pass a variable that could be used in an if statement in the loop?

    Anyone have any idea how to do either of those things?

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

  • Robin W
    Moderator

    @robin-w

    you can still call loop single reply, but just amend that template and put it into in your theme.

    so if you wanted to amend loop-single-reply you would do the following

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    find
    wp-content/plugins/bbpress/templates/default/bbpress/loop-single-reply.php
    Make a copy of this file, and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/loop-single-reply.php

    bbPress will now use this template instead of the original
    and you can amend this


    Kineta
    Participant

    @kineta

    @robin-w Thanks Robin. I still need to use the loop-single-reply as it is, what I’m trying to do is call an additional custom loop that also threads. (I’m putting an index of linked post titles above the threaded replies. Example on my test site: http://jpr-test.com/boards/topic/lets-make-a-giant-thread/ )

    The solution I came up with isn’t very elegant, but it works. I ended up creating a copy of the BBP_Walker_Reply class with a different name, just to direct it to a different loop. Seems like a lot of duplicated code to change one line. But I can’t think of any other way to do it.


    Robin W
    Moderator

    @robin-w

    if it works…. 🙂

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