Skip to:
Content

BuddyPress.org

#7922 closed feature request (wontfix)

bp_get_template_part() does not allow movement of /buddypress/ folder

Reported by: theZman Owned by:
Milestone: Priority: normal
Severity: trivial Version: 3.0.0
Component: Core Keywords: 2nd-opinion close
Cc:

Description

Problem:
can not move the /buddypress/ directory into any other folders within the theme.

Proposed/requested solution:
Please define a constant that can be used to define the buddypress template file locations to allow moving the buddypress template files into more convenient locations

//this might be added to functions.php
define( 'BUDDYPRESS_THEME_ROOT_DIR', 'integrations/buddypress'); //beautiful...
define( 'BUDDYPRESS_THEME_ROOT_DIR', 'any/folder/name'); // conveniant
define( 'BUDDYPRESS_THEME_ROOT_DIR', 'multisite/buddypress/custom'); //dynamic
define( 'BUDDYPRESS_THEME_ROOT_DIR', 'multisite/buddypress/green_theme'); //elegant
define( 'BUDDYPRESS_THEME_ROOT_DIR', 'multisite/buddypress/blue_theme'); //effective

This would open up a wide verity of functionality and make for a more elegant folder structure when a theme developer wants to place all integrations into 1 folder.

To elaborate - please consider the following-
Folder Structure:
wp-content/themes/my-theme/buddypress/members/single/activity

bp_get_template_part( 'members/single/activity' ); // Works as expected, of course

However, this does not work
Folder Structure:
wp-content/themes/my-theme/integrations/buddypress/members/single/activity

bp_get_template_part( 'integrations/buddypress/members/single/activity' ); 
// does not work
// it looks of course for 'buddypress/integrations/buddypress/'

Thank you for your consideration in this matter.

Change History (2)

#1 @r-a-y
23 months ago

  • Keywords 2nd-opinion close added; needs-patch removed

There's already a filter, 'bp_get_template_locations':
https://buddypress.trac.wordpress.org/browser/tags/3.1.0/src/bp-core/bp-core-template-loader.php#L406

You can use that to define custom directory locations and probably get your ideal setup working this way.

#2 @DJPaul
21 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from assigned to closed

@theZman Welcome! Thank you very much for sharing your views with us, and for using BUddyPress.

I agree with Ray that using the bp_get_template_locations filter is the intended solution for this. We want to support multiple possible folders for template parts, rather than just one location defined by a constant.

Note: See TracTickets for help on using tickets.