Need this code on bbPress Forum & Topic Pages Only

Community Forums Forums General Discussion Need this code on bbPress Forum & Topic Pages Only

This topic is: resolved

This topic contains 5 replies, has 2 voices, and was last updated by  AC 2 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #17341


    I am trying to get this code to work to help out on another forum topic –

    How can I get the following code to work on the Forum & Topic Pages only? When using the Share buttons. If we use simple hooks and place this code in the “before_post_content” and execute PHP for example – it is appearing on all pages and posts. We only want it at before post content on Forum & Topic Pages – we want the share buttons to continue to be placed in the footer as it normally does.

    <?php echo sharing_display(); ?>

    I guess there are others out there trying to figure this out on bbPress forums and also on

    Thanks in advance.



    Would someone be able to assist with this? Thanks.


    David Decker

    Hi there!

    You have to make sure to not hook this in globally but only on bbPress pages.

    So I have come up with this solution:

    Place the code in your functions.php or a functionality plugin. (without the opening “< ? php" please!)

    This displays it at begin of single forums view, at begin of single topic view (also for lead topics!).
    If you want to display on every reply then you have to uncomment the included line with the action hook.
    Otherwise comment out any action_hook line that you don't want to use.

    Just tested this code myself and was working great :)



    Oh David, thank you. One little question – if they wanted to move the Share buttons to a different hook area where would they change that?

    There is a discussion here where people are looking too for this answer – Not sure if you want to post your “great” coding solution there or not.


    David Decker

    I’ll post that later on on this forum :)

    Yes, you can change the hooks from bbPress but make sure they belong to the loop. bbPress has so many hooks just try another one that better fits your needs. Most of them are not documented yet, I always look into the very source code… :)

    I hope I understand your point correctly.

    Just on the go, might check it later this evening again…
    -Dave :)



    You did and thanks again for helping!

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Need this code on bbPress Forum & Topic Pages Only’ is closed to new replies.