Skip to:
Content
Pages
Categories
Search
Top
Bottom

Featured image for directories (page ID)


  • doubleF
    Participant

    @doublef

    Hi !

    I’m just wondering if there is anyway to get the ID of the page assigned to a Buddypress component.

    What I mean is that when we assign a page to the Members component I can’t find anyway to get its ID :

    As get_the_ID() is not working because it’s not the classic loop from WP. And I don’t find any ID stuff in members/index.php

    I also checked this function bp_is_members_directory() which works great but no ID involved.

    Moreover, the BP_MEMBERS_SLUG isn’t updated when we we update the page slug :/ So we can compare it to the current page’s slug.

    I’m in a deadend, the main idea behind is to get the featured image working on these pages (activity, members, groups).

    Any idea ?

    Thank you 🙂

    Best regards,

    2F

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

  • shanebp
    Moderator

    @shanebp

    Just go to wp-admin > Pages and roll-over the Edit link to the Members page.
    You should see something like: …/wp-admin/post.php?post=18&action=edit
    And in this case, the post id is 18


    doubleF
    Participant

    @doublef

    Hi,

    Well the main idea is to find out that ID, because I don’t know this ID for the guys using my theme 🙂 In my case yes, but I’m looking to get it from PHP.

    Thanks 🙂

    2F


    danbp
    Participant

    @danbp

    BuddyPress use 3 pages by default: members, groups and activity and a small bunch of templates depending the context.
    These 3 pages are not used as ordinary WP pages, and exist for internal usage with WordPress, as slug placeholder only. These pages must stay empty and independant of any template or model.

    The best way to add featured images, is to hook into an existing function/filter or action. There’s no need for a static page.

    For more complex addition, you can use plugin.php template file which exist in /single/ directory of members and groups component template.

    See get_posts and get_the_post_thumbnail on WP Codex
    Post type of featured image is attachement

    Read also about BuddyPress:

    Post Types Activities

    Template Overload from a Plugin


    or a working example similar to what you try to do (if i understand you correctly).
    https://buddypress.org/support/topic/my-contributions-tab-with-subtabs/#post-244609


    danbp
    Participant

    @danbp

    To check you’re on the right “page” in BuddyPress, use the appropriate function
    Groups: bp_is_groups_component

    Activity: bp_is_activity_component

    Member: bp_is_members_component


    doubleF
    Participant

    @doublef

    Thank you very much @danbp, I’ll look on that 😉

    Best regards

    2F

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Featured image for directories (page ID)’ is closed to new replies.
Skip to toolbar