Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to assign a special template only to buddypress pages (activity, members, profile...). All other posts / pages use a different template. Problem is: I just can't find a good way to tell if a page is "rendered" by buddypress or by the wp "core". I've looked in the bp codex and found the template tag bp_is_member() and others, but none for an overall approach. Are there hooks that I could use or other template tags that I didn't find?

I'm not looking for a customization of the sidebar only, so conditional widget plugins won't do the job.

Any help is appreciated Heiner

share|improve this question

2 Answers 2

up vote 1 down vote accepted

bp_current_component() does not necessarily return a boolean - it returns false if not in a BP component, but will return the name of the component otherwise, as a string.

Internally, BP uses the function bp_is_blog_page() to do what you're asking - if it returns true, it's not a BP page.

share|improve this answer
    
Thanks, that is a perfect solution! –  Heiner Mar 21 '12 at 11:02

Ok, I've found the solution to my problem. Buddypress offers a simple function that returns a boolean value:

bp_current_component();

Now all I have to do is call that function and include it in an if else statement.

Thanks to ZaMoose who has found this easy solution http://xrl.us/bmxm8e

Hope this helps some else also.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.