Skip to content

Shortcode - [bpstickyposts]

Render a list of pinned activities anywhere - a sidebar widget, a custom welcome page, an “Announcements” section in the footer.

Note: the shortcode reads from the plugin’s option-based sticky-post store (bpsp_activity_sticky_posts, the bpsp_user_activity_sticky_posts user meta, and bpsp_groups_sticky_posts), not from the {prefix}bpsp_sticky_posts database table. On installs that store pins in the database table, the shortcode may show fewer items than the activity stream, or “No sticky posts found”. Verify the output on your site before relying on it in a public layout.

[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 the option-based sticky-post store on every render. 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.