Skip to:
Content
Pages
Categories
Search
Top
Bottom

need a ‘button’ in the bar


  • lorenzocoffee
    Member

    @lorenzocoffee

    Hi,

    given I don’t like to mess up with BBPress betas and RCs I went for SMF forum (which I like),my question is this:

    How can I add a button in the ‘main tab'(the one of Home-About-Docs etc etc)

    and wich file(s)to edit it?

    reply can be useful for other needs too.

    Many thanks

    PS: WP mu 2.7+BP

Viewing 7 replies - 1 through 7 (of 7 total)
  • You mean adding a link to your form in the theme? Create a file called smf-link.php and put the following in it (changing it to the smf install):

    <?php

    function add_forum_link() {
    echo '<li><a href="http://yourdomain.com/your-smf-url.php">Forums</a></li>';
    }
    add_action( 'bp_nav_items', 'add_forum_link' );

    ?>

    Trent

    Didn’t finish my thoughts…sorry, put that smf-link.php in your /mu-plugins/ folder and then it will withstand upgrades without having to edit core files…

    Trent


    lorenzocoffee
    Member

    @lorenzocoffee

    Many thanks Trent!

    Yes I’ m in need to add or rename (and relink) one button just to divert traffic on desired URL

    Basically just to add a button to Home Theme Tab(here: Home About Blog Forums Docs Demo Download)

    But if I do need 2 more buttons in the tab shall I proceed twice as you tought me above?

    Thanks againg for the time and the teaching

    No more difficult, but functions need different names for example, this brings 3 buttons in:

    <?php

    function add_forum_link() {
    echo '<li><a href="http://yourdomain.com/your-smf-url.php">Forums</a></li>';
    }

    function add_about_link() {
    echo '<li><a href="http://yourdomain.com/about.php">About</a></li>';
    }

    function add_download_link() {
    echo '<li><a href="http://yourdomain.com/downloads.php">Downloads</a></li>';
    }

    add_action( 'bp_nav_items', 'add_forum_link' );
    add_action( 'bp_nav_items', 'add_about_link' );
    add_action( 'bp_nav_items', 'add_download_link' );

    ?>

    All can be in the same file called extras-links.php or whatever in /mu-plugins/ or you could create 3 seperate files with the functions, but if you have many, it is better in one plugin I think.

    Trent


    lorenzocoffee
    Member

    @lorenzocoffee

    Great Trent!

    Many many Thak you, very last request to do not stress you further: where it’s possible to retrive those ‘declarations’,meaning others too ?

      ‘add_forum_link’

      ‘add_about_link’

      ‘add_download_link’

    Thanks again for your assistance,

    I think many users would find This info helpful, for sure

    Each function has to have a different name or else php will break plugin into errors. Every function on your install has to have a unique name, so I was just saying each little function has has the button created needs a unique names, yes. You can put as many as you want in there as long as they have different function names.

    ‘add_forum_link’

    ‘add_about_link’

    ‘add_download_link’

    ‘add_buddypresslove_link’

    ‘add_donate_link’

    etc

    Trent


    lorenzocoffee
    Member

    @lorenzocoffee

    Oh, I ve’got it :mrgreen:

    Thanks again Trent.

    ED: brilliant tweak, fast and effective

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘need a ‘button’ in the bar’ is closed to new replies.
Skip to toolbar