Skip to:
Content
Pages
Categories
Search
Top
Bottom

Q and A using bbpress


  • knaveenchand
    Participant

    @knaveenchand

    I am trying to design a Question and Answer theme by customizing bbpress where Topics will be Questions and Replies will be Answers. I am able to change the display names and slug names of ‘Forums’, ‘Topics’ and ‘Replies’ into ‘Sectors’, ‘Questions’ and ‘Answers’ respectively using str_ireplace functions. (Please note that I have also changed ‘Posts’ into ‘Answers’). Its pretty easy until here. The problem I am facing is this:

    When the single topic is displayed, the headers appear like this:

    Author | Answers
    Admin | What is the Capital of USA?
    User1 | It's hmm.. I don't know.
    User2 | I think its New York.
    User3 | No Guys its washing ton.

    The first post is in fact the Question. Unfortunately it also appears under Answers. I understand that I have to deal with the loop now because all posts looped in this topic naturally appear under Posts (in my case ‘Answers’). This was how bbpress is designed. But is there a way where I can have a different header for the very first post in my single topic and rest of the posts will have different header. For example:

    Author | Question
    Admin | What is the Capital of USA?

    Author | Answers
    User1 | It's hmm.. I don't know.
    User2 | I think its New York.
    User3 | No Guys its washing ton.
    Author | Answers

    How do I get this? Do I have to edit the loop or call it twice? If so, how do I set the query to get only first post in the first block and all posts minus first post in the second block.

    Would appreciate any help. Thank you.

    PS: I am using bbpress 2.2.3 along with Skeleton Theme (which has inbuilt theme support for bbpress).

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

  • Lynq
    Participant

    @lynq

    Do you have a seperate loop for replies? I have a loop-replies and a loop-topics.

    So inside loop-replies you could set the header as answers and then inside loop-topics you can set the header as Answer. It all depends on how your template is setup.

    You can also use https://codex.bbpress.org/bbp_show_lead_topic/ as used here on bbpress.org to use a different template for the ‘lead topic’.

    An alternative to your str_replace method is to make your own language translation. https://codex.buddypress.org/developer/extending-buddypress/customizing-labels-messages-and-urls/


    knaveenchand
    Participant

    @knaveenchand

    Thanks for both @Lync and @netweb. I have been able to use lead topic function and it worked. I have reviewed the link you sent as an alternative to str_replace. I now have a different yet related question: Is it possible to have different headers for different forums. For instance, can I have one template for Q and A forum and another template for Jobs forum, and so on…? In each of the forum, I would prefer a different header. Is it possible to get this done through PO MO files or str_replace or any other functions? Thanks for your help.

    I have not tried this (nor have I tried a custom pomo myself yet) so how well this would all work and fit together could get nasty quite quickly 🙂

    You could setup WordPress as a ‘multisite’ and have custom PO MO files on each site…

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