Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add WP Engine Fix.
<?php
/**
* Add WP Engine Fix.
*/
function yz_fix_wpengine_scripts_fix () {
if ( bp_is_group() || is_page( 'activity' ) || bp_is_activity_directory() ) {
wp_enqueue_script( 'buddypress_query',BP_PLUGIN_URL . 'bp-core/js/jquery-query.min.js',array( 'jquery' ) );
wp_enqueue_script( 'buddypress_cookie',BP_PLUGIN_URL . 'bp-core/js/vendor/jquery-cookie.min.js',array( 'jquery' ) );
wp_enqueue_script( 'buddypress_js', YOUZIFY_ASSETS . 'js/buddypress.min.js',array( 'jquery' ));
wp_enqueue_script( 'buddypress_scrollto',BP_PLUGIN_URL . 'bp-core/js/vendor/jquery-scroll-to.min.js',array( 'jquery' ) );
$params = apply_filters( 'bp_core_get_js_strings', array(
// Strings for display.
'accepted' => __( 'Accepted', 'buddypress' ),
'close' => __( 'Close', 'buddypress' ),
'comments' => __( 'comments', 'buddypress' ),
'leave_group_confirm' => __( 'Are you sure you want to leave this group?', 'buddypress' ),
'mark_as_fav' => __( 'Favorite', 'buddypress' ),
'my_favs' => __( 'My Favorites', 'buddypress' ),
'rejected' => __( 'Rejected', 'buddypress' ),
'remove_fav' => __( 'Remove Favorite', 'buddypress' ),
'show_all' => __( 'Show all', 'buddypress' ),
'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
'show_x_comments' => __( 'Show all comments (%d)', 'buddypress' ),
'unsaved_changes' => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
'view' => __( 'View', 'buddypress' ),
// Settings.
'store_filter_settings' => apply_filters( 'bp_legacy_store_filter_settings', is_user_logged_in() ),
) );
wp_localize_script( 'buddypress_js', 'BP_DTheme', $params );
}
}
add_action( 'wp_enqueue_scripts', 'yz_fix_wpengine_scripts_fix' );
@perezcarreno

This comment has been minimized.

Copy link

@perezcarreno perezcarreno commented Jul 28, 2020

Hello! I just noticed this script is missing the enqueing of "scrollTo". Without it, the site seems to run great until you try to comment on something on the wall.

Here's the missing line:
wp_enqueue_script( 'buddypress_scrollto',BP_PLUGIN_URL . 'bp-core/js/vendor/jquery-scroll-to.min.js',array( 'jquery' ) );

Cheers!

@torrid33

This comment has been minimized.

Copy link

@torrid33 torrid33 commented Jan 27, 2021

This script is also missing the ending ?> for a php script at the bottom.

@torrid33

This comment has been minimized.

Copy link

@torrid33 torrid33 commented Jan 27, 2021

Is BP_PLUGIN_URL set elsewhere or do we need to change that to the url for our site???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment