【问题标题】:WordPress navigation menuWordPress 导航菜单
【发布时间】:2014-03-20 06:24:12
【问题描述】:

我目前有一个使用以下内容构建的导航菜单,

<?php 
            if(!is_user_logged_in()) {
                wp_page_menu('show_home=1&exclude=214&exclude_tree=80');
            } else {
                wp_page_menu('show_home=1&exclude=214');
            }
        ?>

我的问题是我有一些 BuddyPress 页面需要添加到由 WordPress 创建的父级,基本上我有一个称为“成员内容”的父级

该会员内容有“调查”、“文档”之类的子项,但我还希望我的 BuddyPress 安装中的论坛、组、成员也成为会员内容的子项。

【问题讨论】:

    标签: php wordpress wordpress-theming buddypress


    【解决方案1】:

    Buddypress 有几个页面,您将不得不调用它。您需要手动包含页面,所以它看起来像这样:

    <?php 
            if(!is_user_logged_in()) {
                wp_page_menu('show_home=1&exclude=214&exclude_tree=80');
            } else {
                wp_page_menu('show_home=1&exclude=214');
    

    class="已选择"> //" 标题="">

            <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' ) && bp_is_active( 'groups' ) && ( function_exists( 'bp_forums_is_installed_correctly' ) && !(int) get_site_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; ?>
    
    
            }
        ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-18
      • 2019-09-08
      • 2017-03-30
      • 2012-12-11
      • 2017-07-04
      • 2015-12-13
      • 2016-09-14
      相关资源
      最近更新 更多