Info
- 2 posts
- 1 voice
- Started 4 years ago by nolageek
- Latest reply from nolageek
- This topic is not resolved
sharing wordpress sidebars - profile link only in bbpress? how?
-
- Posted 4 years ago #
I'm using the ThemePress theme, that uses the header/footer from the integrated wordpress install as well co-mingles the various template functions. What I'm trying to do is put code in the wordpress sidebar (not widget) that will show the bbpress profile link/login ONLY when the user is in the forum, otherwise it will show a link to go to the forum.
In the sidebar, I've tried
<?php if ( $forums ) : login_form(); if ( is_bb_profile() ) profile_menu(); endif; ?>Thinking that, since I can supposedly use each other's functions, the if if ($forums) would work. I was wrong. :)
I also tried trying to set $is_forum = 1; in front-page.php and in the sidebar:
<?php function show_bbmenu() { if ( $is_forum ) : login_form(); if ( is_bb_profile() ) profile_menu(); endif; ?> } show_bbmenu(); ?>Among other things and apparently I'm overlooking something stupid and easy but I'm afraid insomnia is not being kind to me this morning. :)
(Did I mention I got stuck in an elevator at my office for an hour last night? grrrr)
This is at adultaggregator.com/forum (warning, not safe for work.)
-
- Posted 4 years ago #
I knew it was something simple.. some sleep helped me figure out I was missing a 'global $forum'
I got it working with the following:
In my theme's functions:
<?php function show_bblogin() { global $forum; if ( $forum ) { login_form(); if ( is_bb_profile() ) profile_menu(); } else { echo '<a href="/forum/">Visit the Forum!</a></br>'; } } ?>and in my sidebar:
<?php show_bblogin(); ?>Works like a champ.
-
You must log in to post.