Skip to:
Content

BuddyPress.org

Opened 8 years ago

Closed 8 years ago

Last modified 3 years ago

#4089 closed enhancement (wontfix)

add_theme_support BP-Default Theme

Reported by: chrisclayton Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Templates Keywords:
Cc:

Description

After reading and having a short discussion about buddypress parent/child themes over at #3662 i'm wondering if it would be worthwile to make a add_theme_support to inherit some of bp-defaults core files that aren't usually modified, while still being able to create the theme as a parent theme, thus allowing modification.

Something like...
add_theme_support( 'bp-default', array( 'ajax', 'globaljs' ) );

Thus, i could create a parent theme, with one less thing to worry about and then allow users of my theme to edit the theme via a child theme.

Discuss?

Change History (7)

#1 in reply to: ↑ description @chrisclayton
8 years ago

Replying to chrisclayton:

Thus, i could create a parent theme, with one less thing to worry about and then allow users of my theme to edit the theme via a child theme.

Thus allowing better use of upgradeablity, something that you cannot do while using child themes.

Would anyone like to see examples of buddypress users using released child themes (like frisco) who have expressed concerns over how to upgrade their themes?

#2 @boonebgorges
8 years ago

If theme authors want to release BP themes that are not child themes of bp-default but take advantage of bp-default's AJAX and JS, it can be done as follows, without the use of add_theme_support():

// Include AJAX handlers
include( BP_PLUGIN_DIR . '/bp-themes/bp-default/_inc/ajax.php' );

// Enqueue bp-default's JS and localize
function mytheme_enqueue_bp_default_js() {
	wp_enqueue_script( 'dtheme-ajax-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array( 'jquery' ), bp_get_version() );

	$params = array(
		'my_favs'           => __( 'My Favorites', 'buddypress' ),
		'accepted'          => __( 'Accepted', 'buddypress' ),
		'rejected'          => __( 'Rejected', 'buddypress' ),
		'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
		'show_all'          => __( 'Show all', 'buddypress' ),
		'comments'          => __( 'comments', 'buddypress' ),
		'close'             => __( 'Close', 'buddypress' ),
		'view'              => __( 'View', 'buddypress' ),
		'mark_as_fav'	    => __( 'Favorite', 'buddypress' ),
		'remove_fav'	    => __( 'Remove Favorite', 'buddypress' )
	);
	wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
}
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_bp_default_js' );

Using add_theme_support() only makes sense if BP starts adopting use of current_theme_supports(). Can you give examples of what kinds of things would appear in the following conditional?

if ( current_theme_supports( 'bp-default' ) ) {
   // do something
}

There may be cases in the future where it makes sense, for a specific new BP feature, to introduce use of add_theme_support(), but I'm not sure what it would mean in the case of bp-default itself.

#3 @chrisclayton
8 years ago

We adopted use of current_theme_supports with commits r5747 and r5749

I was pretty much thinking the same thing you mentioned above, but pretty much wrapping most of that using current theme support.

I was going to write a patch when i posted this, but i thought i'd get some opinions if it's worth writing it, I personally am a huge fan child/parent themes due to their upgradeability and thus i'm really passionate about fixing whatever is stopping alot of of these 'feature rich' themes building them as parent themes, especially a theme being marked as a bp core project (#3662), as i'm constantly reminded of WordPress' philosophy of 'Design for the majority' http://wordpress.org/about/philosophy/ (which i always thought was BP's philosophy too) But; i'm not sure if this will even fix those issues.

"I'm not sure what it would mean in the case of bp-default itself."

Since bp-default is packaged within the plugin, i thought it would be pretty much the same as adding any other feature with add_theme_support, since the theme doesn't get touched (as if it doesn't exist) if it's not active the code would be in core, but i classified this ticket it in the 'theme' component since that is what it's directly related too :)

Last edited 8 years ago by chrisclayton (previous) (diff)

#4 @DJPaul
8 years ago

The addition in r5747 is about future-proofing BP-Default. If a theme does add_theme_support( 'buddypress' ), the template compatibility layer won't be loaded -- you're saying "I don't need your help anymore and I have everything under control".

The only other use in trunk is add_theme_support( 'bp-default-responsive' ), which controls whether to load the responsive CSS file.

#5 @chrisclayton
8 years ago

  • Resolution set to wontfix
  • Status changed from new to closed

meh. closing as wontfix. CBF with it, if someone else wants to reopen it and continue discussing and create a patch feel free. Child themes are easy enough to fork plus, i gots a better patch i need to work on.

#6 @johnjamesjacoby
8 years ago

  • Milestone Awaiting Review deleted

#7 @DJPaul
3 years ago

  • Component changed from Appearance - Template Parts to Templates
Note: See TracTickets for help on using tickets.