Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to create submenu containing BuddyPress tabs (editing header.php)?


  • raynerlim36
    Participant

    @raynerlim36

    Hi :D

    The details are as follows:

    • WordPress Version: MultiUser 2.9.2
    • BuddyPress Version: 1.2.2.1
    • Theme: Avenue K9, Michael Kuhlmann’s B2 Theme Pack (Theme works fine)
    • I have used WordPress for a few months only.
    • I am a BuddyPress newbie.
    • I know some HTML.
    • I do not know PHP at all.

    Hi again :D

    I really need urgent help in editing /wp-content/plugins/buddypress/bp-themes/bp-default/header.php as I am in a hurry to meet the deadline.

    I want to move the Activity, Members, Groups and all the other BuddyPress links into a list item called “Community”.

    If that is possible, please let me know how to do it (my code is shown below, which doesn’t work), if not, please recommend a theme that I can acheive this functionality with, be it a Buddymatic theme or not.

    To give you a better understanding, my sitemap is shown below:

    • Home
    • Community

      • Activity
      • Members
      • Groups
      • Forums
      • Blogs

    • Expositions

      • Secondary 1
      • Secondary 2
      • Secondary 3
      • Secondary 4
      • Secondary 5

    • Creative Expressions

      • Secondary 1
      • Secondary 2
      • Secondary 3
      • Secondary 4
      • Secondary 5

    • Situational Writing

      • Secondary 1
      • Secondary 2
      • Secondary 3
      • Secondary 4
      • Secondary 5

    • Useful Links
    • Contact Us

    My code (which of course does not work since I’m a newbie) loooks like this:

    <div id="header">
    <h1 id="logo"><a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php bp_site_name() ?></a></h1>
    <ul id="nav">
    <li <?php echo site_url() ?>" title="<?php _e( 'Community', 'buddypress' ) ?>">
    <ul title="Community">
    <li<?php if ( bp_is_front_page() ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo site_url() ?>" title="<?php _e( 'Home', 'buddypress' ) ?>"><?php _e( 'Home', 'buddypress' ) ?></a>
    </li>
    <?php if ( 'activity' != bp_dtheme_page_on_front() && bp_is_active( 'activity' ) ) : ?>
    <li<?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/" title="<?php _e( 'Activity', 'buddypress' ) ?>"><?php _e( 'Activity', 'buddypress' ) ?></a>
    </li>
    <?php endif; ?>
    <li<?php if ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo site_url() ?>/<?php echo BP_MEMBERS_SLUG ?>/" title="<?php _e( 'Members', 'buddypress' ) ?>"><?php _e( 'Members', 'buddypress' ) ?></a>
    <li>
    <?php if ( bp_is_active( 'groups' ) ) : ?>
    <li<?php if ( bp_is_page( BP_GROUPS_SLUG ) || bp_is_group() ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo site_url() ?>/<?php echo BP_GROUPS_SLUG ?>/" title="<?php _e( 'Groups', 'buddypress' ) ?>"><?php _e( 'Groups', 'buddypress' ) ?></a>
    </li>
    <?php if ( bp_is_active( 'forums' ) && ( function_exists( 'bp_forums_is_installed_correctly' ) && !(int) bp_get_option( 'bp-disable-forum-directory' ) ) && bp_forums_is_installed_correctly() ) : ?>
    <li<?php if ( bp_is_page( BP_FORUMS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo site_url() ?>/<?php echo BP_FORUMS_SLUG ?>/" title="<?php _e( 'Forums', 'buddypress' ) ?>"><?php _e( 'Forums', 'buddypress' ) ?></a>
    </li>
    <?php endif; ?>
    <?php endif; ?>
    <?php if ( bp_is_active( 'blogs' ) && bp_core_is_multisite() ) : ?>
    <li<?php if ( bp_is_page( BP_BLOGS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
    <a href="<?php echo site_url() ?>/<?php echo BP_BLOGS_SLUG ?>/" title="<?php _e( 'Blogs', 'buddypress' ) ?>"><?php _e( 'Blogs', 'buddypress' ) ?></a>
    </li>
    <?php endif; ?>
    </ul>
    </li>
    <?php wp_list_pages( 'title_li=&depth=1&exclude=' . bp_dtheme_page_on_front() ); ?>
    <?php do_action( 'bp_nav_items' ); ?>
    </ul><!-- #nav -->
    <div id="search-bar">
    <div class="padder">
    <form action="<?php echo bp_search_form_action() ?>" method="post" id="search-form">
    <input type="text" id="search-terms" name="search-terms" value="" />
    <?php echo bp_search_form_type_select() ?>
    <input type="submit" name="search-submit" id="search-submit" value="<?php _e( 'Search', 'buddypress' ) ?>" />
    <?php wp_nonce_field( 'bp_search_form' ) ?>
    </form><!-- #search-form -->
    <?php do_action( 'bp_search_login_bar' ) ?>
    <div><!-- .padder -->
    </div><!-- #search-bar -->
    <?php do_action( 'bp_header' ) ?>
    </div><!-- #header -->

    Can someone please help me to acheive this (by showing the code please)?

    Thank you very much for everyone’s help!

    Rayner

Viewing 10 replies - 26 through 35 (of 35 total)

  • raynerlim36
    Participant

    @raynerlim36

    @mcrustk2

    Good to hear that it’s working. Maybe you should read this article about standards compliant drop down menus.

    @takeo David you are a genius! Thank you so much – works really well. I just wonder how it is done here on buddypress.org where the entire “community” is sitting in its own subfolder? Does anyone know? (I know the thread is a bit old, but…)

    I have hit a problem with the drop down menu. I have been using David’s code successfully and adjusted it to my needs, but only noticed now that Internet Explorer does not show the menu correctly. It gets covered up by the main page I don’t understand why or how to fix it. It works in FireFox and Chrome though.

    If someone could point me in the right direction please, that would be great.

    Solved it: Compatibility View was turned on in IE8. Once I turned it off, things worked as expected.


    pcwriter
    Participant

    @pcwriter

    @David

    Hot diggety… it works flawlessly! I’ve been trying to do this for a while.
    Now, it’s just a question of fiddling with the css to get it to fit and look dandy.

    Thanks!:-)


    pcwriter
    Participant

    @pcwriter

    @David Lewis

    Thanks again for a great bit of code!

    You wouldn’t happen to have an idea as to how to exclude from the navbar the “auto-generated” tabs from plugins such as BP-Links or BP-Gallery, and include them also in the dropdown, now would you?
    :-)


    @mercime
    Keymaster

    @mercime

    @pcwriter move do_action( ‘bp_nav_items’ ); sorry can’t add code here … to right after the li of Community links


    pcwriter
    Participant

    @pcwriter

    @mercime

    Snap! That worked (didn’t occur to me to try that one). I really do have to bone up on what all these actions do…:-)

    Thanks Mercime


    @mercime
    Keymaster

    @mercime

    @pcwriter, you’re welcome. We will need to change code come WP3.0/BP1.3, it will be simpler then because all components will be rendered as WP Pages. Cheers.


    rathyesha
    Member

    @rathyesha

    The details are as follows:

    WordPress Version: 3.1
    BuddyPress Version: 1.2.8
    Theme: Buddy Press Default 1.2.7 By BuddyPress
    I am using WordPress for first time
    I know some HTML.
    I do not know PHP at all.

    @David thank for the code.

    I would like to create a Submenu for that theme.
    I have got still problem to create a child theme. It would be helpful if someone could help me with it.
    I need it soon for my coursework.
    I would be thankful for any quick answer.

Viewing 10 replies - 26 through 35 (of 35 total)
  • The topic ‘How to create submenu containing BuddyPress tabs (editing header.php)?’ is closed to new replies.
Skip to toolbar