Activity ShortCode Usage – Shortcode for BuddyPress Pro

Get Started

Shortcode Usage

The ActivityShortCode allows for flexible display and customization of BuddyPress activities using a variety of attributes.
To use this shortcode, add the following to your page or post content:

[activity-listing title="Recent Activities" display_comments="threaded" per_page="10" load_more="yes"]

Shortcode Attributes

Attribute Type Description
title string Title of the activity section.
display_comments string/int Display comments mode: threaded, stream, or false to hide comments.
include int/string Comma-separated list of specific activity IDs to include.
exclude int/string Comma-separated list of specific activity IDs to exclude.
sort string Sort order: ASC or DESC.
page int Which page of activities to load (e.g., 1, 2, etc.).
per_page int Number of activities per page. Default is 10.
max int Maximum number of activities to include. Default is no limit.
scope string Filter activities by scope: friends, groups, favorites, or mentions.
load_more string Whether to show a load more button (yes or no).
user_id int Show activities for a specific user ID.
role string Filter by user roles (e.g., administrator).
object string Filter by object type (e.g., groups, profile).
for_group string Group slug for filtering activities (useful if object=groups).
action string Filter by activity action (e.g., activity_update).
primary_id int Filter by primary object ID (e.g., group ID).
secondary_id int Filter by secondary object ID (e.g., post ID).
search_terms string Search term for filtering activities.
allow_posting string Whether to show an activity posting form (yes or no).
pagination string Whether to show pagination (yes or no).
container_class string CSS class for the activity container. Default is activity.

Filters and Actions

Filters

  1. activity_shortcode_attributes
    • Description: Modify the attributes before they are processed.
    • Usage Example:
      add_filter( 'activity_shortcode_attributes', function( $atts ) {
       $atts['title'] = 'Custom Activity Title';
       return $atts;
      });
  2. activity_shortcode_bash_query
    • Description: Customize the query arguments for filtering activities.
    • Usage Example:
      add_filter( 'activity_shortcode_bash_query', function( $query ) {
       $query['sort'] = 'ASC';
       return $query;
      });
  3. activity_shortcode_template_args
    • Description: Modify the arguments passed to the activity template.
    • Usage Example:
      add_filter( 'activity_shortcode_template_args', function( $args ) {
       $args['limit'] = 20;
       return $args;
      });
  4. activity_shortcode_output
    • Description: Adjust the final output of the shortcode before it’s returned.
    • Usage Example:
      add_filter( 'activity_shortcode_output', function( $output ) {
       return '<div class="custom-wrapper">' . $output . '</div>';
      });

Actions

  1. before_activity_shortcode_render
    • Description: Triggered before the activity content is rendered.
    • Usage Example:
      add_action( 'before_activity_shortcode_render', function( $atts ) {
       echo '<p>Before Activities</p>';
      });
  2. after_activity_shortcode_render
    • Description: Triggered after the activity content is rendered.
    • Usage Example:
      add_action( 'after_activity_shortcode_render', function( $args ) {
       echo '<p>After Activities</p>';
      });
  3. activity_shortcode_inside_container
    • Description: Triggered inside the activity container for adding custom content.
    • Usage Example:
      add_action( 'activity_shortcode_inside_container', function( $atts, $template_args ) {
       echo '<div class="custom-content">Inside Activity Container</div>';
      }, 10, 2 );

Example Usage

[activity-listing title="Group Activities" object="groups" for_group="my-group" per_page="5" load_more="yes"]

This example shortcode will display activities for a specific group (my-group) with 5 items per page and a “Load More” button.


For more customizations, use the provided filters and actions to adjust parameters and output as needed.

Last updated: October 22, 2025