Skip to:
Content
Pages
Categories
Search
Top
Bottom

Can\'t I use bp template tags in my own template?

  • Avatar of Ousep
    ousep
    Participant

    @ousep

    This might seem like a very basic question… but it’s had me stumped for a while.

    Do I really have to use the bp-sn-whatever template to be able to use any of buddypress’s functionality?

    Perhaps I misunderstand the function of the whole plugin, but I presumed it would be like any other plugin… I activate the plugin, and it gives me a function. Which comes with a shortcode or template tag that I drop into my posts or my template files.

    For instance, BP has a nice little function called bp_signup_page(). Normally, I’d create a new page template, get_header, _sidebar and _footer it, and select the template when I create a new blank page called Register.

    And the output I’d expect would be a page that looks like my site, and has a nice little login form in the middle. Turns out I’m way off the mark. I need to use the one template that’s provided with the plugin, and have my site look like every other BP site out there. Yeah.. i can change my colours… but i’m working on a modified P2 theme. I need to plug that functionality in, too.

    This is beginning to look a lot like Drupal in its early days (perhaps even now…), all the functionality you need, as long as you stick to the one layout.

    I’m ranting here, I know. But this seems to go completely against the way WP functions. And then, completely against the way BP functioned when it was still being developed. Perhaps you guys should look at making it more of a plugin, and less of a theming protocol.

    PS: using the latest WPMU and BP, as of now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Avatar of outolumo
    outolumo
    Participant

    @outolumo

    I just went through the default bp-sn-parent theme and harvested all the action hooks beginning with bp_ to a list. Could someone put it to the codex? This list could be useful for people developing their own BuddyPress themes. I hope I didn’t miss anything.

    Because these hooks appear in the default BuddyPress theme, some plugin developers might assume their existance in bp-themes. Therefore they should probably exist somewhere in the custom template files. Most of these are are fairly generic and could be filtered into existing themes (e.g. bp_head() could be filtered using wp_head() hook), assuming that the theme you are building on is properly saturated with hooks.

    Note that the optionsbar.php, userbar.php and plugin-template.php need to be added to your theme. I don’t know if they could be filtered.

    The notable exception being the search-login-bar and nav-items. IMO they shouldn’t be in the BuddyPress template at all. Better solution would be to have functions for search-box & login widget, and insert them to the template using tags for those. This would make them both more reusable – e.g. search-box could be re-used on search and 404 templates – and flexible, allowing to login box to appear separate from the search box. Likewise the nav-menu should be widgetized, i.e. made a function that can be called somewhere from the page.

    While not exactly a template tag issue, theme developers should be aware that the buddypress admin bar is by default activated at the wp_footer() as follows:

    add_action( ‘wp_footer’, ‘bp_core_admin_bar’, 8 );

    I’m gonna try placing the following to the functions.php:

    remove_action(‘wp_footer’, ‘bp_core_admin_bar’, 8);

    add_action( ‘i_want_it_here_tag’, ‘bp_core_admin_bar’, 8 );

    ====================================================

    header.php

    <?php do_action( ‘bp_head’ ) ?> (In the head section.)

    <?php do_action( ‘bp_before_search_login_bar’ ) ?>

    <?php do_action( ‘bp_login_bar_logged_out’ ) ?>

    <?php do_action( ‘bp_login_bar_logged_in’ ) ?>

    <?php do_action( ‘bp_search_login_bar’ ) ?>

    <?php do_action( ‘bp_after_search_login_bar’ ) ?>

    <?php do_action( ‘bp_before_header’ ) ?>

    <?php do_action( ‘bp_nav_items’ ); ?>

    <?php do_action( ‘bp_header’ ) ?>

    <?php do_action( ‘bp_after_header’ ) ?>

    <?php do_action( ‘bp_before_container’ ) ?>

    ====================================================

    footer.php

    <?php do_action( ‘bp_after_container’ ) ?>

    <?php do_action( ‘bp_before_footer’ ) ?>

    <?php do_action( ‘bp_footer’ ) ?>

    <?php do_action( ‘bp_after_footer’ ) ?>

    ====================================================

    Content wrappers: inside #container, but containing #content.

    index.php

    <?php do_action( ‘bp_before_blog_home’ ) ?>

    <?php do_action( ‘bp_after_blog_home’ ) ?>

    single.php

    <?php do_action( ‘bp_before_blog_single_post’ ) ?>

    <?php do_action( ‘bp_after_blog_single_post’ ) ?>

    404.php

    <?php do_action( ‘bp_before_404′ ) ?>

    <?php do_action( ‘bp_after_404′ ) ?>

    archive.php

    <?php do_action( ‘bp_before_archive’ ) ?>

    <?php do_action( ‘bp_after_archive’ ) ?>

    page.php

    <?php do_action( ‘bp_before_blog_page’ ) ?>

    <?php do_action( ‘bp_after_blog_page’ ) ?>

    attachment.php

    <?php do_action( ‘bp_before_attachment’ ) ?><

    <?php do_action( ‘bp_after_attachment’ ) ?>

    links.php

    <?php do_action( ‘bp_before_blog_links’ ) ?>

    <?php do_action( ‘bp_after_blog_links’ ) ?>

    search.php

    <?php do_action( ‘bp_before_blog_search’ ) ?>

    <?php do_action( ‘bp_after_blog_search’ ) ?>

    ====================================================

    Post wrappers – everything within the Loop. N.B. not every loop is listed here.

    index.php, single.php, archive.php, attachment.pgp, search.php

    <?php do_action( ‘bp_before_blog_post’ ) ?>

    <?php do_action( ‘bp_after_blog_post’ ) ?>

    ====================================================

    Some specific tags allowing to replace the entire loop:

    404.php

    <?php do_action( ‘bp_404′ ) ?>

    search.php

    <?php do_action( ‘bp_blog_post’ ) ?>

    ====================================================

    The mandatory Buddypress templates:

    optionsbar.php

    <?php do_action( ‘bp_before_options_bar’ ) ?>

    <?php do_action( ‘bp_inside_before_options_bar’ ) ?>

    <?php do_action( ‘bp_inside_after_options_bar’ ) ?>

    <?php do_action( ‘bp_after_options_bar’ ) ?>

    userbar.php

    <?php do_action( ‘bp_before_user_bar’ ) ?>

    <?php do_action( ‘bp_inside_before_user_bar’ ) ?>

    <?php do_action( ‘bp_inside_after_user_bar’ ) ?>

    <?php do_action( ‘bp_after_user_bar’ ) ?>

    plugin-template.php

    <?php do_action(‘bp_template_content_header’) ?>

    <?php do_action(‘bp_template_title’) ?>

    <?php do_action(‘bp_template_content’) ?>

    =================================

    Special templates:

    comments.php

    <?php do_action( ‘bp_before_blog_comment_list’ ) ?>

    <?php do_action( ‘bp_after_blog_comment_list’ ) ?>

    <?php do_action( ‘bp_before_blog_comment_form’ ) ?>

    <?php do_action( ‘bp_blog_comment_form’ ) ?>

    <?php do_action( ‘bp_after_blog_comment_form’ ) ?>

    searchform.php

    <?php do_action( ‘bp_before_blog_search_form’ ) ?>

    <?php do_action( ‘bp_blog_search_form’ ) ?>

    <?php do_action( ‘bp_after_blog_search_form’ ) ?>

    sidebar.php

    <?php do_action( ‘bp_before_blog_sidebar’ ) ?>

    <?php do_action( ‘bp_inside_before_blog_sidebar’ ) ?>

    <?php do_action( ‘bp_inside_after_blog_sidebar’ ) ?>

    <?php do_action( ‘bp_after_blog_sidebar’ ) ?>

    More details about how these tags are applied can be found by looking at the files in the bp-sn-parent -theme.

    DJPAUL IS CRIT BY A WALL OF TEXT FOR 100,000,000 DAMAGE AND DIES.

    http://codex.buddypress.org/developer-docs/action-reference/ lists the actions for the controller code for BuddyPress. A one-minute search of the codex doesn’t show a page of the actions in the theme. If you think this will be useful you are able to add/edit pages on the BuddyPress Codex.

    For Ousep’s post:

    Do I really have to use the bp-sn-whatever template to be able to use any of buddypress's functionality?

    No. Just like WordPress has its famouse “Loop”, BuddyPress implements its own Loops for all of the core components and features. See http://codex.buddypress.org/developer-docs/custom-buddypress-loops/.

    There is a range of different theme information on the Codex, but you are able to copy all of the templates from the BuddyPress parent theme into any WordPress theme and it will work. You will need to add custom CSS to style those elements, obviously.

    Avatar of Ousep
    ousep
    Participant

    @ousep

    Well…. it’s that simple?

    i tried it out on a random page, and it worked… but for styling.

    It really should be written somewhere… on the extend/themes page, perhaps. So people put together some themes and populate the page.

    Thanks! You’ve made my life a whole lot easier.

    Avatar of outolumo
    outolumo
    Participant

    @outolumo

    @DJPaul

    Yep, I did that search too, and as I didn’t find a list I made one. Then I tried to add it to the codex, but don’t really know how. I can only see the “Edit This Page”, link, but nothing happens when I click it.

    Using Firefox 3.5.3 on Windows XP.

    Avatar of Ishimwe
    Ishimwe
    Participant

    @ishimwe

    I am having a small issue with the new theming structure (I read all documentation there’s. So please don’t refer me there)….

    I want to carry out custom changes and so far so good. However, when I use <?php bloginfo(‘template_url’) ?> it takes files from the bp-sn-parent theme. But I want to store those info in the “custom_theme” I created.

    How do I reference the custom theme say in the header?

    Thasnk

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.