Below are 10 popular examples of using the GroupShortCode with various parameter combinations to achieve specific functionality.
Example 1: Display Popular Groups with Grid Layout
[groups-listing title="Popular Groups" type="popular" per_page="6" grid="yes" loop_layout="three"]
- Explanation: Displays 6 popular groups per page in a 3-column grid format.
Example 2: Alphabetical List of Groups
[groups-listing title="All Groups" type="alphabetical" orderby="name" per_page="10" grid="no"]
- Explanation: Shows an alphabetical list of all groups with 10 groups per page in list format.
Example 3: Recently Active Public Groups
[groups-listing title="Active Public Groups" type="active" status="public" per_page="5" grid="yes" loop_layout="two"]
- Explanation: Displays 5 active, public groups per page in a 2-column grid.
Example 4: Specific Group Types Only (Projects and Teams)
[groups-listing title="Projects and Teams" group_type__in="project,team" per_page="8" grid="yes" loop_layout="four"]
- Explanation: Shows groups of types
projectandteamin a 4-column grid, 8 groups per page.
Example 5: Excluding Certain Groups by ID
[groups-listing title="Featured Groups" exclude="101,102,103" type="newest" per_page="6" grid="no"]
- Explanation: Displays the newest groups but excludes groups with IDs 101, 102, and 103.
Example 6: User-Specific Groups in Alphabetical Order
[groups-listing title="Groups for User" user_id="123" type="alphabetical" orderby="name" per_page="5"]
- Explanation: Shows groups alphabetically for the specified user (ID 123) with 5 groups per page.
Example 7: Recent Groups with Private Status Only
[groups-listing title="Private Groups" type="newest" status="private" grid="no"]
- Explanation: Displays the most recent private groups in a list layout.
Example 8: Groups with Specific Group IDs
[groups-listing title="Selected Groups" include="201,202,203" grid="yes" loop_layout="three"]
- Explanation: Shows groups with IDs 201, 202, and 203 in a 3-column grid layout.
Example 9: Child Groups of a Specified Parent Group
[groups-listing title="Sub-groups" parent_id="300" grid="yes" loop_layout="two"]
- Explanation: Displays child groups of the group with ID 300 in a 2-column grid format.
Example 10: Random Groups with Custom CSS Class
[groups-listing title="Random Groups" type="random" per_page="4" container_class="custom-group-container"]
- Explanation: Shows 4 random groups per page with a custom CSS class applied to the group container.
These examples showcase different ways to configure the GroupShortCode for various use cases within BuddyPress.
