Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Buddypress Pages Post ID


  • mizzinc
    Participant

    @mizzinc

    Hello.

    WordPress: 3.6.1
    Buddypress: 1.8.1

    When viewing any of the three default pages (Activity, Groups, Members) the post ‘ID’ ($post->ID or the_ID()) returns ‘0’ in a wordpress theme file ‘content-page.php’

    <article id="post-0" class="post-0 bp_members type-bp_members status-publish hentry">
    <header class="entry-header">
    <h1>Members</h1>
    </header>
    <div class="entry-content">
    <div id="buddypress">
    

    I have searched support and not found anyone with a similar problem, so It might be theme related, that said, I am just starting out, so if anyone has some thoughts on why this is happening would be greatly appreciated to help to resolve it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • What’s the problem?

    BP pages are not strictly posts they use the_content() to simply pass through BP data, they are a sort of faux post.

    Why do you need a class there, there are plenty of class tokens to hook onto.


    mizzinc
    Participant

    @mizzinc

    Wow, fast response.

    Hi Hugo, I require the post ID when viewing a page to access post_meta information. This works when accessing a WordPress page. When accessing the default ‘Activity, Groups or Members’ page the post ID returns ‘0’, why?

    sorry extended my response above.

    You may need to explain why you want or need post_meta for a bp page, there wouldn’t be any would there?


    mizzinc
    Participant

    @mizzinc

    Simple styling options. Show/Hide page title, breadcrumbs, feature image?

    Hmm, after reading your extended response, perhaps I am approaching this from the wrong angle.

    Think you are, but not quite sure what to suggest, but using options table is a possibility? But even then you have to remember that the page doesn’t really exist or at least technically you only have one template file to add logic to, although you can extend that with the additions made to template hierarchy in 1.8.

    You possibly need to be targeting filters at the content based on a page check perhaps in combo with a series of option values?


    mizzinc
    Participant

    @mizzinc

    Ok. Think the filter route is the way to go. I will post my results.

    Thanks Hugo.


    mizzinc
    Participant

    @mizzinc

    Solution:

    Well not really, I just added a conditional around the ‘<header class=”entry-header”>’ to not display if on a BP blog page.


    dizplay
    Participant

    @dizplay

    Hello,
    same problem here.
    In header (included part) i have a call to a custom variable (made by Types [plugin for custom post type]).
    So the script implicitly use the page ID to select the field
    $bluetext = types_render_field(“bluetext-field”, array(“output”=>”raw”));
    Since the page ID is 0 the custom texts doesn’t appear.
    there’s a workaround to get the ‘container’ wordpress page id ?

    tks in advance!


    dizplay
    Participant

    @dizplay

    solved by myself:

    get the id with:
    <?php
    $myID = get_queried_object_id();//get the ID
    echo do_shortcode(“[types field=’my-field’ id=’$myID’]”);
    ?>

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Resolved] Buddypress Pages Post ID’ is closed to new replies.
Skip to toolbar