The terminology is important here. WordPress ‘pages’ shouldn’t be confused with the more loosely termed web ‘page’. Although BP ‘pages’ are webpages, they aren’t WordPress pages so is_page()
isn’t going to work *most of the time*. The exception is register, activate etc.
For a list of template tags you can use with BP ‘pages’ take a look at:
Template Tag Reference
I add the coode in post 1 to twentytwelve
I create a page in WordPress and call it ‘my-members’
I view the page
is_page() returns ‘1’
I install and activate buddypress
I ‘Associate a WordPress Page with each BuddyPress component directory.’ and set members pointing at ‘my members’
I view the page
is_page() now returns null
I don’t know about you, but to me this seems like a bug in buddypress
Just some observations
1. ‘my members’ isn’t the same as ‘my-members’
2. <?php echo 'is_page()='.is_page().'<br>'; ?>
– why are you doing this?
I don’t know about you, but to me this seems like a bug in buddypress
There may well be a bug in BuddyPress – but I can’t tell that from the code and info you’ve posted.
the ‘my-members’ / ‘my members’ was a typo – it is the same WordPress page
<?php echo 'is_page()='.is_page().'<br>'; ?>
– why are you doing this?
why, to demonstrate the issue. this is something you can do in 5 minutes to reproduce an issue I am seeing in a theme. Instead of pointing to the theme in question, I’ve shown the ‘bug’ in twentytwelve so anyone can reproduce it.
BP overrides WP a bit. If you use bp_is_current_component('activity')
it works on BP pages. This is something that needs to be fixed now that BP uses any theme.
Ah right, I see what you’re doing.
‘my-members’ is no longer a WP page at the moment you point your BP members directory at ‘my-members’. Is that what you’re saying is a bug?
‘my-members’ is no longer a WP page? Hmmm it still shows up in the page editor, so yes I would call that a bug. Why do you have to associate a WP page with a BP component directory?
bottom line, if BP is going to work with any theme then when a page is displayed, the is_page() should work.
in addition, if I change the page name and slug in the WP page editor, BP recognizes it…so BP is tied to the page…
as a matter of fact, if I was to set the page as the WP ‘front_page’ the function is_front_page() returns null
one additional note: in BP 1.7.1 is_page() returned a ‘1’
one last thought. If BP is going to work with ‘any’ theme, then if I make a BP page my front page (the reason doesn’t matter) then
1) is_front_page() should also return a ‘1’, but it doesn’t.
2) the classes on the <body> should return
home-page home page page-id-nnnn page-template-default
in addition to the BP classes
if I had decided to style my front page blue using
body.home-page {background-color: blue;}
and then activating BP should not ignore that CSS, but it will the way things stand now.
@juggledad
Thanks for explaining in more detail. If you feel this is a bug, you can submit a ticket on Trac
Trac is the best place to follow the development process and submit bug reports.
@modemlooper I have a feeling that ticket will fix quite a few outstanding bugs!