bp_core_moment_js_config()

Return moment.js config.

Description

Return

(string)

Source

File: bp-core/bp-core-cssjs.php

function bp_core_moment_js_config() {
	// Grab the locale from the enqueued JS.
	$moment_locale = wp_scripts()->query( 'bp-moment-locale' );
	$moment_locale = substr( $moment_locale->src, strpos( $moment_locale->src, '/moment-js/locale/' ) + 18 );
	$moment_locale = str_replace( '.js', '', $moment_locale );

	$inline_js = <<<EOD
jQuery(function() {
	moment.locale( '{$moment_locale}' );
});
EOD;

	return $inline_js;
}

Changelog

Changelog
Version Description
BuddyPress 2.7.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.