Skip to:
Content
Pages
Categories
Search
Top
Bottom

sorting posts by topic_title

  • @psymatix

    Member

    Hello,I’m a wordpress user and I just downloaded bbpress for a project I’m working on since I can’t get some key features on wordpress. My project involves polls that can be created by users of the site, and also regular forum topics.

    I have gotten the polls plugin bbpress polls and it adds ‘[poll]’ in front of the topic title. now I want to use this feature to display topics with polls separately from topics that don’t have polls since this seems to be the most distinguishing factor.

    My question is how can I get the topic title in the loop for use in my code? the Function topic_title() displays the topic i.e. it echoes it, but I would like to get it as a string that I can use in functions.

    Also, I would like to know how I can get a reference of all the index keys in the $topics array so I can use them in my code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • @bagi-zoltan

    Member

    Hi,

    $query="SELECT topic_id FROM bb_topics";will return the array of the topic ids.

    Regards

    @kawauso

    Member

    Use get_topic_title() to retrieve the topic title as a string while in the loop.

    To get the actual index keys of the $topics array, you can use array_keys, or if you want to actual topic IDs, you’d need to use $topic->topic_id inside a foreach loop assigning $topic.

    @psymatix

    Member

    thanks. I’m guessing the get_ works for other properties too?

    @kawauso

    Member

    Pretty much. The non get_ version is just an echo of the get_ one anyway :)

    https://trac.bbpress.org/browser/trunk/bb-includes/functions.bb-template.php

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