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 1 year, 8 months ago.

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

    AC
    Blocked
    Post count: 7712

    I am trying to get this code to work to help out on another forum topic – http://www.studiopress.com/forums/topic/help-with-jetpack-sharing-icons-on-bbpress-forums-and-going-green-child-theme/).

    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]<?php echo sharing_display(); ?>[/php]

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

    Thanks in advance.

    #17561

    AC
    Blocked
    Post count: 7712

    Would someone be able to assist with this? Thanks.

    #17824

    David Decker
    Moderator
    Post count: 95

    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 :)


    #17826

    AC
    Blocked
    Post count: 7712

    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 – http://bbpress.org/forums/topic/social-media-share-button-missing/. Not sure if you want to post your “great” coding solution there or not.

    #17852

    David Decker
    Moderator
    Post count: 95

    I’ll post that later on on this bbpress.org 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 :)


    #17928

    AC
    Blocked
    Post count: 7712

    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.