Skip to:
Content
Pages
Categories
Search
Top
Bottom

Set Topic ID

  • Hi, I’m experimenting with embedding some of the bbPress commenting features into an existing website and I was wondering how to set a topic ID.

    If I do something like this it will return the topic title just fine:

    $topic = get_topic( 162 );

    $topic_id = $topic->topic_id;

    echo $topic->topic_title;

    But as soon as I try something like this I realize that I don’t have an active topic because it no longer returns the information:

    $topic = get_topic( 162 );

    $topic_id = $topic->topic_id;

    if (is_topic()) echo $topic->topic_title;

    Hope that was clear,

    Thanks!

Viewing 1 replies (of 1 total)

  • _ck_
    Participant

    @_ck_

    Not quite sure what you are asking/doing buy try adding global $topic; before your code if you find the function don’t know which topic is active.

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