Skip to:
Content
Pages
Categories
Search
Top
Bottom

Conditional no longer working – is_front_page() for activity front page

  • @andy277

    Participant

    I have set the main activity page as the front page in admin > reading:

    Front page displays: static page: Front page: Activity.

    I have a few conditionals with is_front_page() but it stopped working for some reason, not sure if it was because of an upgrade. is_front_page() still works if I set a non BuddyPress page as the front page, it only doesn’t work if I set a BuddyPress page as the front page like the ‘activity’ page or ‘members’ page.

    Is this supposed to happen? And what is the best alternative to use, is it bp_is_activity_front_page() because that one works.

Viewing 4 replies - 1 through 4 (of 4 total)
  • @r-a-y

    Keymaster

    You should use bp_is_component_front_page( 'activity' ) instead.

    @andy277

    Participant

    Thanks @r-a-y that does work for the front page, but bp_is_component_front_page( 'activity' ) or the one I just suggested bp_is_activity_front_page() doesn’t seem to work correctly when using the activity parse args filter. The best solution I’ve got now is using ! bp_is_user() && bp_is_current_component( 'activity' ) This makes this work correctly:

    /* Display just the activity updates for who the the logged-in 
    user is following and updates from the logged in user*/
    
    function am_activity_filter( $retval ) {
       
       if ( ! bp_is_user() && bp_is_current_component( 'activity' ) ) {  
    	   $retval['scope'] = 'following,just-me'; 
    	   $retval['action'] = 'activity_update';  
       }
       
       return $retval;
    }
    add_filter( 'bp_after_has_activities_parse_args', 'am_activity_filter' );

    The problem with this conditional bp_is_component_front_page( 'activity' ) in my activity parse args filter is activity items keep showing from everyone instead of the items from who a user is following (I’m using your master follow plugin). The items that are not supposed to display, disappear when the user refreshes the page which makes the correct items display, but they keep coming back through the ‘load newest’. Have you tried this? Nevertheless ! bp_is_user() && bp_is_current_component( 'activity' ) is the one that is working correctly for this.

    @r-a-y

    Keymaster

    but bp_is_component_front_page( ‘activity’ ) or the one I just suggested bp_is_activity_front_page() doesn’t seem to work correctly when using the activity parse args filter.

    bp_is_component_front_page( 'activity' ) is supposed to act as a replacement for front page checks, not for activity component checks.

    If you’re checking for the activity directory page in bp_parse_args(), then try using bp_is_activity_directory() instead.

    @andy277

    Participant

    Iv’e got the activity directory page set as the front page, so I thought it would still work. bp_is_activity_directory() looks like the best one though. Thanks @r-a-y

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional no longer working – is_front_page() for activity front page’ is closed to new replies.
Skip to toolbar