Skip to:
Content

BuddyPress.org

Changeset 5747


Ignore:
Timestamp:
02/13/2012 03:26:12 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Tweak bp-default's functions.php, and add theme support for BuddyPress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/functions.php

    r5737 r5747  
    5959 */
    6060function bp_dtheme_setup() {
    61     global $bp;
    6261
    6362    // Load the AJAX functions for the theme
     
    6665    // This theme styles the visual editor with editor-style.css to match the theme style.
    6766    add_editor_style();
     67
     68    // This theme comes with all the BuddyPress goodies
     69    add_theme_support( 'buddypress' );
    6870
    6971    // This theme uses post thumbnails
     
    208210        wp_enqueue_style( 'bp-default-responsive', get_template_directory_uri() . '/_inc/css/responsive.css', array( 'bp-default-main' ), $version );
    209211
    210         if ( is_rtl() )
     212        if ( is_rtl() ) {
    211213            wp_enqueue_style( 'bp-default-responsive-rtl', get_template_directory_uri() . '/_inc/css/responsive-rtl.css', array( 'bp-default-responsive' ), $version );
     214        }
    212215    }
    213216}
     
    376379 */
    377380function bp_dtheme_widgets_init() {
    378     // Register the widget columns
     381
    379382    // Area 1, located in the sidebar. Empty by default.
    380383    register_sidebar( array(
     
    585588 * Used when the custom menus haven't been configured.
    586589 *
    587  * @global object $bp Global BuddyPress settings object
    588590 * @param array Menu arguments from wp_nav_menu()
    589591 * @see wp_nav_menu()
     
    591593 */
    592594function bp_dtheme_main_nav( $args ) {
    593     global $bp;
    594 
    595595    $pages_args = array(
    596596        'depth'      => 0,
     
    626626 * Applies BuddyPress customisations to the post comment form.
    627627 *
    628  * @global string $user_identity The display name of the user
    629628 * @param array $default_labels The default options for strings, fields etc in the form
    630629 * @see comment_form()
     
    632631 */
    633632function bp_dtheme_comment_form( $default_labels ) {
    634     global $user_identity;
    635633
    636634    $commenter = wp_get_current_commenter();
    637     $req = get_option( 'require_name_email' );
    638     $aria_req = ( $req ? " aria-required='true'" : '' );
    639     $fields =  array(
     635    $req       = get_option( 'require_name_email' );
     636    $aria_req  = ( $req ? " aria-required='true'" : '' );
     637    $fields    =  array(
    640638        'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'buddypress' ) . ( $req ? '<span class="required"> *</span>' : '' ) . '</label> ' .
    641639                    '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
     
    714712 */
    715713function bp_dtheme_sidebar_login_redirect_to() {
    716     $redirect_to = apply_filters( 'bp_no_access_redirect', !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '' );
    717 ?>
     714    $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
     715    $redirect_to = apply_filters( 'bp_no_access_redirect', $redirect_to ); ?>
     716
    718717    <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
     718
    719719<?php
    720720}
     
    726726 * Display navigation to next/previous pages when applicable
    727727 *
    728  * @global unknown $wp_query
     728 * @global WP_Query $wp_query
    729729 * @param string $nav_id DOM ID for this navigation
    730730 * @since 1.5
     
    733733    global $wp_query;
    734734
    735     if ( $wp_query->max_num_pages > 1 ) : ?>
     735    if ( !empty( $wp_query->max_num_pages ) && $wp_query->max_num_pages > 1 ) : ?>
     736
    736737        <div id="<?php echo $nav_id; ?>" class="navigation">
    737738            <div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'buddypress' ) ); ?></div>
    738739            <div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'buddypress' ) ); ?></div>
    739740        </div><!-- #<?php echo $nav_id; ?> -->
     741
    740742    <?php endif;
    741743}
Note: See TracChangeset for help on using the changeset viewer.