Skip to:
Content
Pages
Categories
Search
Top
Bottom

php condition to detect that we are in the forum


  • minutepapillon
    Participant

    @minutepapillon

    Hi,
    I am building a multilingual (WPML plugin) website with a Bbpress forum inside. The forum is not multilingual and the fact that bbpress uses page.php to generate its pages causes the flag icons to display. They are not needed and they point to nowhere …
    So I have to suppress the flags icons in the header when the page.php is displaying a forum.
    But how can I test (in php) that I am in the forum ?

    Thanks for any clue.

    Nicolas

Viewing 5 replies - 1 through 5 (of 5 total)
  • is_bbpress() is what your looking for.


    minutepapillon
    Participant

    @minutepapillon

    Hi Stephen,
    I have two reasons to thank you :
    1) Your answer is short and easy to understand.
    2) It works. ;)
    Have a nice day,
    Bye
    Nicolas


    TobiasHartmann
    Participant

    @tobiashartmann

    Hello,

    I am using WordPress with bbPress(2.4) an buddyPress(1.8.1).

    Trying to change the image when I am in the forum.

    Trying it with : <?php if ( is_bbPress() ) : ?> in my content.php under my theme…

    No effect !

    Are there other ways to change the appearance?

    Greetings,
    Tobias


    niuserre
    Participant

    @niuserre

    content.php seems like a weird place to be swapping an image, is this a header image or something?

    From the way you’ve worded it I think maybe you need an if else statement around the specific image?

    if( is_bbpress() ) {
    
    // bbpress image
    
    } else {
    
    // default image
    
    }

    Is that the issue? If not, could you describe a bit more what you’re expecting to happen and what is happening instead please? It could also be that you actually need a BuddyPress if call rather than bb.


    TobiasHartmann
    Participant

    @tobiashartmann

    Tried it in content-page.php VOILA! It works…..

    Thank you – was on the wrong page.

    I keep the image suggestion in my head.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.