Skip to:

Are these things possible?

  • Hello all,

    I recently dove into the exciting world of BBPress, and in the midst of working out a custom theme (tweaking structure as well), I was wondering if the following things were even possible to do, or are they more suited to be plugin requests?

    – attach forum name to latest topics of main page. ie I want to have a topic display like this:

    “Plugins | Lorem ipsum dolor sit amet”

    (where “Plugins” is the forum name and “Lorem ipsum dolor sit amet” is the topic, obviously.

    – Within each topic, separate the original post from the comments. I guess this is similar to how a blog entry is; with the entry featured at the top, and the comments displayed below and less prominently. It seems like the way BBPress is coded they can only be stacked on top of each other and have a similar design treatment?

    – Tweak post count so that if no has yet replied to a post it is “0” instead of “1”

    Hopefully these are just things that are right under my nose that I haven’t been able to figure out, but let’s see…


Viewing 4 replies - 1 through 4 (of 4 total)
  • – You’d want to use forum_name( $topic->forum_id ).

    – I think so. If you look at the code you’ll see an array of posts, and by using array_shift() you can detach the first one and have some special template code just for that. Be sure to check it’s the first post of the topic, though, not just the first post of the page. Maybe a better thing to do would be to add a class to each post giving it a topic-specific number, so you can style topic-post-1 or whatever individually.

    – Where in your template I assume it says topic_posts(), replace that with echo( get_topic_posts() - 1 );

    Thanks! 1st and 3rd things are resolved.

    I’ve been trying hundreds of different things/syntaxes to get the second item to work, but to no avail yet. I’m sure it must be the way I’m trying to code it (Full disclosure: I’m still trying to learn PHP).

    What I’m going for is as follows:

    Run the foreach, and then using array_shift(), grab the first item in the array, and then display just the post_text() that is contained within that array (assuming this is an array within an array)

    This what my code (stripped down) looks like:


    <? php foreach ($posts as $bb_post) : $del_class = post_del_class(); ?>


    php array_shift();

    echo post_text();


    <?php endforeach; ?>


    and then later on, when the responses are displayed:

    <? php foreach ($posts as $bb_post) : $del_class = post_del_class(); ?>

    <?php echo post_text(); ?>

    <?php endforeach; ?>

    I was hoping the first initial post wouldn’t be displayed since array_shift() would have taken it out?

    Any help would be greatly appreciated…

    The documentation should help you understand how to use array_shift():

    Thanks much! Finally got it working the way I want to. For everyone’s reference here’s how to do the separation:

    Where the first one is going to go:


    foreach ($posts as $bb_post) : $del_class = post_del_class();

    post_text(); // Other variables, etc





    Then, where the rest of them are going to appear:

    <?php foreach ($posts as $bb_post) : $del_class = post_del_class();

    php bb_post_template();

    endforeach; ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar