How can I load buddypress ajax without using the template pack plugi n?
I had this in a non-buddypress compatible theme’s functions.php.
include( BP_PLUGIN_DIR . '/bp-themes/bp-default/_inc/ajax.php' );
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' );
This is how I have used the default BP ajax queries/scripts in a custom BuddyPress theme:
(gist with code: https://gist.github.com/3154297 )
Nevermind. I found a quick solution myself, although it doesn’t load as fast as the ajax on the default theme.
In my functions.php, I have this: