正在查看 4 个帖子:1-4 (共 4 个帖子)
-
作者帖子
-
做客户 bbPress 主题定制单,其中一个需求就是因为使用的主题已经有自带的比较好的用户中心现在需要重定向 bbPress 个人资料链接到自定义链接地址到的主题用户中心。
我可以用这个简单的代码来完成重定向:
add_filter( 'bbp_pre_get_user_profile_url', function() { return get_bloginfo('url').'/profile'; });
修改其中的
/profile
地址即可。很简单,真的!
您还可以通过以下操作更改收藏夹和订阅的默认网址:
// Replace the default link for the favorites add_filter( 'bbp_get_favorites_permalink', function() { return get_bloginfo('url').'/profile/forum-favorites'; }); // Replace the default link for subscriptions add_filter( 'bbp_get_subscriptions_permalink', function() { return get_bloginfo('url').'/profile/forum-subscriptions'; });
此回复已被标记为私有,🔒 仅楼主及管理员可见。给 bbPress 添加全局搜索框:
//display bbPress search form above sinle topics and forums function rk_bbp_search_form(){ if ( bbp_allow_search()) { ?> <div class="bbp-search-form"> <?php bbp_get_template_part( 'form', 'search' ); ?> </div> <?php } } add_action( 'bbp_template_before_single_forum', 'rk_bbp_search_form' ); add_action( 'bbp_template_before_single_topic', 'rk_bbp_search_form' );
非常棒的方法。
隐藏 bbPress 的全部侧边栏
/* Hide SideBar in bbPress Profiles and Topics*/ function disable_all_widgets( $sidebars_widgets ) { if ( function_exists('is_bbpress') ) { if (is_bbpress()) { $sidebars_widgets = array(false); remove_all_actions('bp_register_widgets'); unregister_sidebar( 'bp_core_widgets' ); } } return $sidebars_widgets; } add_filter('sidebars_widgets', 'disable_all_widgets', 1, 1);
-
作者帖子
正在查看 4 个帖子:1-4 (共 4 个帖子)
- 哎呀,回复话题必需登录。