Skip to content

Shortcode — [bpstickyposts]

Render the current set of pinned activities anywhere — a sidebar widget, a custom welcome page, an “Announcements” section in the footer. The shortcode reuses the same data layer the activity stream uses, so the list is always in sync.

[bp_sticky_posts]

With no attributes, it renders up to 5 sitewide pinned activities, newest first, with author and date.

Attribute Values Default Description
type activity, groups, user activity Which scope to render
user_id integer 0 Required when type="user"
group_id integer 0 Required when type="groups"
max integer 5 Maximum posts to display
show_meta yes, no yes Show author avatar, display name, and relative date
show_actions yes, no no Show a “View” link below each activity
title string empty Optional heading above the list
class string empty Extra CSS classes on the wrapper <div>

show_actions="yes" adds a View link to the activity permalink. It does not add pin or unpin controls — those live on the activity stream itself.

# Top 3 sitewide announcements with a heading
[bp_sticky_posts type="activity" max="3" title="Announcements"]
# Featured posts from a specific user (profile page sidebar)
[bp_sticky_posts type="user" user_id="42" title="Featured by Jane"]
# Group pins list with a View link on each item
[bp_sticky_posts type="groups" group_id="10" show_actions="yes"]
# Compact list — no author/date, custom wrapper class
[bp_sticky_posts class="my-announcements" max="5" show_meta="no"]

Drop a Shortcode block and paste the markup. The block previews exactly what the front-end will render.

Use the Shortcode widget (in classic widgets) or paste the shortcode into a Custom HTML block in the widget area.

When no sticky posts match the type/user_id/group_id, the shortcode outputs:

<p class="bpsp-no-sticky-posts">No sticky posts found.</p>

You can target that class in your theme CSS to style the empty state.

The shortcode output is not separately cached — it reads live from the same option/database source the activity stream uses. If you use a full-page cache plugin, clear it after pinning or unpinning so the shortcode output reflects the change.

  • REST API — for headless / JS rendering of pinned posts.
  • Pin Scopes — what type="activity|groups|user" maps to in the database.