Community Forums › Forums › Archived Forums › General Discussion › Need this code on bbPress Forum & Topic Pages Only
Tagged: bbPress, hooks, php, share buttons, sharing
- This topic has 5 replies, 2 voices, and was last updated 12 years, 4 months ago by
AnitaC.
-
AuthorPosts
-
February 2, 2013 at 8:28 am #17341
AnitaC
KeymasterI am trying to get this code to work to help out on another forum topic - http://www.studiopress.community/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 echo sharing_display(); ?>
I guess there are others out there trying to figure this out on bbPress forums and also on WordPress.org.
Thanks in advance.
Need help with customization or troubleshooting? Reach out to me.
February 3, 2013 at 12:41 am #17561AnitaC
KeymasterWould someone be able to assist with this? Thanks.
Need help with customization or troubleshooting? Reach out to me.
February 4, 2013 at 7:57 am #17824David Decker
MemberHi 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 🙂
February 4, 2013 at 8:00 am #17826AnitaC
KeymasterOh 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.
Need help with customization or troubleshooting? Reach out to me.
February 4, 2013 at 9:19 am #17852David Decker
MemberI'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 🙂
February 4, 2013 at 11:44 am #17928 -
AuthorPosts
- The topic ‘Need this code on bbPress Forum & Topic Pages Only’ is closed to new replies.