Notifications
Clear all

wpForo 1.x.x [Closed] How can I make a piece of code show up only for one topic?

5 Posts
2 Users
1 Likes
661 Views
Posts: 42
Topic starter
(@needurhelp)
Trusted Member
Joined: 5 years ago

Like:

if (topic id = 23) {

code here

}

 
4 Replies
Alvina
Posts: 1869
Moderator
(@alvina)
Member
Joined: 4 years ago
I'm sorry but we don't follow you well. Please let us know what you want to show the data array of the topic or the fully designed topic?
If you mean topic array, then you should use the following code:
<?php wpforo_topic($topicid) ?>
3 Replies
(@needurhelp)
Joined: 5 years ago

Trusted Member
Posts: 42

@alvina Sorry, I meant if a user visits a certain topic like topic id 332

it will show a piece of code for that topic for example a Google Analytics script.

Something like:

if (wpforo_topic($topicid) == 332) {
/* code goes here */
}
Alvina
Moderator
(@alvina)
Joined: 4 years ago

Member
Posts: 1869

@needurhelp,

Sorry for the late response.

You should use the following code:

if( WPF()->current_object['topicid'] == 332 ) {
/* code goes here */
}
(@needurhelp)
Joined: 5 years ago

Trusted Member
Posts: 42

@alvina thank you!