Hi Brajesh
I think this could be a bug with BuddyPress.
When you set any WordPress page to the front page in admin > settings > reading > A static page > frontpage. That page (on mysite.com) will then have a body CSS class of ‘home’ and ‘home-page’, and you can use the is_front_page() conditional.
However, if that page is a BuddyPress page (such as the activity directory). That front page (on mysite.com) no longer has ‘home’ and ‘home-page’ in the body CSS and you can’t use the is_front_page() conditional. This used to work but has stopped working for some reason.
I’ve tried this on a fresh WP install with BuddyPress activated. Shouldn’t this be working?
Hi Andy,
Which version of BuddyPress are you using?I had a look and It does not seem to be an issue with BuddyPress 2.4( Using template pack).
Though there are issues when a component is set as home page( specifically for search, which got fixed here https://buddypress.trac.wordpress.org/ticket/5087 and should be part of 2.4.1), The class and is_front_page() seems to work fine.
Please try disabling other plugins except BuddyPress and see if that makes any change?
Thanks Brajesh.
I tried it on a fresh install with the latest WP and latest BuddyPress 2.4 with no plugins except BuddyPress. I’m not sure why it is not working for me anymore, but at least I know it should be working so I’ll see if I can work out what the problem is.
Hi Andy,
It is strange I checked to make sure it works. Please do let me know what you find.Hi Brajesh,
I tested this with the most basic setup it can have:
– Install Worpdpress
– disabled, removed plugins
– enable twenty fifteen theme
– install Buddypress
– Associate a page for the activity stream in settings>buddypress>pages
– Set that page as the homepage in settings>readingThis problem still happens. setting any other page as the front page is fine, but setting Buddypress components as front page this problem happens. This used used to work for me though.
I can usually work these small problems out, but I can’t get it to work at the most basic setup. I’ve got no idea what the problem is.
But because WP and Buddypress is so flexible, there are some ways to work around this. Instead of the ‘home’ class, I can use the frontpage page-id class, and for the conditional, maybe something like
is_activity_directory() && ! is_search()
.But I’ve now created a custom page including the activity-loop and activity-post by code, similar to the file in activity/index.php. This works, I can use the
is_front_page()
conditional and ‘home’ CSS class with this. doing it this way means I also have to add your mention auto suggestions code snippet for the homepage 🙂Good to see that you are progressing on that. I am still not sure why you are not able to use is_front_page() though.
If you find the reason, Please do let me know.
Thank you for using that mention code 🙂
Thank you
BrajeshI definitely will.
Also one other thing about custom activity pages – similar to your recent blog post. I noticed there is one more thing Buddypress doesn’t load on custom activity pages – the scripts for the load newest button (that “Load Newest” button at the top when new content is detected). This would be another cool blog post if you ever find the answer to this.
You must be logged in to reply to this topic.