Notifications
Clear all

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

5 Posts
2 Users
1 Likes
420 Views
needurhelp
Posts: 42
Topic starter
(@needurhelp)
Eminent Member
Joined: 3 years ago

Like:

if (topic id = 23) {

code here

}

 
4 Replies
Alvina
Posts: 1872
Moderator
(@alvina)
Member
Joined: 3 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) ?>
Reply
3 Replies
needurhelp
(@needurhelp)
Joined: 3 years ago

Eminent 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 */
}
Reply
Alvina
Moderator
(@alvina)
Joined: 3 years ago

Member
Posts: 1872

@needurhelp,

Sorry for the late response.

You should use the following code:

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

Eminent Member
Posts: 42

@alvina thank you!

Reply
Share: