Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/31/2010 05:49:36 PM (16 years ago)
Author:
djpaul
Message:

Hide forum directory from main nav if disabled by admin. Fixes #2541, props boonebgorges

File:
1 edited

Legend:

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

    r3626 r3631  
    468468        add_action( 'admin_notices', 'bp_dtheme_show_notice' );
    469469
     470if ( !function_exists( 'bp_dtheme_main_nav' ) ) :
    470471/**
    471472 * wp_nav_menu() callback from the main navigation in header.php
    … …  
    478479 * @since 1.3
    479480 */
    480 function bp_dtheme_main_nav( $args ) { ?>
     481function bp_dtheme_main_nav( $args ) {
     482        global $bp;
     483
     484        $pages_args = array(
     485                'title_li' => '',
     486                'depth' => '0',
     487                'exclude' => bp_dtheme_page_on_front()
     488        );
     489
     490        if ( bp_forum_directory_is_disabled() ) {
     491                if ( !empty( $pages_args['exclude'] ) )
     492                                $pages_args['exclude'] .= ',';
     493
     494                $pages_args['exclude'] .= $bp->pages->forums->id;
     495        }
     496?>
    481497        <ul id="nav">
    482498                <li<?php if ( is_front_page() ) : ?> class="selected"<?php endif; ?>>
    … …  
    484500                </li>
    485501
    486                 <?php wp_list_pages( 'title_li=&depth=0&exclude=' . bp_dtheme_page_on_front() ); ?>
    487                 <?php do_action( 'bp_nav_items' ); ?>
     502                <?php wp_list_pages( $pages_args ) ?>
     503                <?php do_action( 'bp_nav_items' ) ?>
    488504        </ul><!-- #nav -->
    489505<?php
    490506}
     507endif;
    491508
    492509/**
Note: See TracChangeset for help on using the changeset viewer.