Skip to:
Content
Pages
Categories
Search
Top
Bottom

default component for activity widget


  • grosbouff
    Participant

    @grosbouff

    Hi, this is something maybe other users will find useful :

    I have a site-wide sidebar with the bp-activity widget in it;

    and I was looking for a way to set the activity widget content to the current component if we are in its directory.

    Eg :

    -in the blogs directory; show blogs activity as default

    -in the groups directory; show groups activity as default

    -….

    function directory_default_activity() {

    global $bp;

    if (bp_is_directory()) {

    if (empty($_GET[‘afilter’]))$_GET[‘afilter’]=$bp->current_component;

    }

    }

    add_action( ‘wp’, ‘directory_default_activity’ );

    I added that to the functions.php of my theme.

  • The topic ‘default component for activity widget’ is closed to new replies.
Skip to toolbar