TheWebs
TheWebs

Reputation: 12923

How would I detect if I was on the forums page

I have made a WordPress theme, and have managed to detect if bbpress is installed or not and I wanted a proper way to see if I was on the forums, list of topics or topic page.

From what I understand the url structures are as such:

For a very basic install with out the use of sub forms and all that. My question is, would I use GET and or POST or is there some built in wordpress functions I am missing?

I was trying to do:

if('forum' == get_post_type() || 'topic' == get_post_type()){
    echo "I am here"; exit;
}

but that didnt work. So....I am wondering am I missing something?

Upvotes: 0

Views: 468

Answers (1)

Hanzaplastique
Hanzaplastique

Reputation: 564

Not sure if this still is an issue, but this works for me (WP3.x, bbPress plugin 2.x);

$posttype=get_post_type(); 

if (($posttype=='forum')||($posttype=='topic')) 
  { echo "I am here"; }

Upvotes: 1

Related Questions