Skip to:

Wrapping single.php content with BP group context

  • kingkong954


    Any tips on how I could wrap certain kinds of posts (that are using single.php to display their content) with a group wrapper?

    For example, I have an events manager plugin that uses single.php for displaying content (custom post type).

    If an event is associated with a group (a function inherit to the plugin, but allows me to pull out a gorup ID), I would like single.php to take on the group wrapper for that event.

    Current issue I am having is trying to trick BP into thinking there is a current_group loaded in $bp->groups->current_group.

Viewing 3 replies - 1 through 3 (of 3 total)

  • kingkong954


    I partially figured it out via $bp->groups->current_group = new BP_Groups_Group(‘id here’);

    …I proceed to basically make a call to bp_get_template_part( ‘groups/single/home’ ), but its treating me (the logged in user) like a user without access to the group (even though I am a super admin). It wont show the nav, doesnt show a proper group title, etc.

    I’m wondering if this isnt the best route to go in trying to wrap this content with a BP context?



    Why not create a group tab called event and then output cpt



    The plugin has already created a tab called Events; from there it shows a full calendar view (with proper group context).

    They went the route of making the individual events WP content types (which I think is wise). I just can’t figure out how to style single posts with a proper BP group wapper.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wrapping single.php content with BP group context’ is closed to new replies.
Skip to toolbar