bp_core_moment_js_config

Return moment.js config.

Description

(string) bp_core_moment_js_config(); 

Returns (string)


Usage

  1. if ( !function_exists( 'bp_core_moment_js_config' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-cssjs.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_moment_js_config(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-cssjs.php  
  1. function bp_core_moment_js_config() { 
  2. // Grab the locale from the enqueued JS. 
  3. $moment_locale =wp_scripts)->query( 'bp-moment-locale' ); 
  4. $moment_locale = substr( $moment_locale->src, strpos( $moment_locale->src, '/moment-js/locale/' ) + 18 ); 
  5. $moment_locale = str_replace( '.js', '', $moment_locale ); 
  6.  
  7. $inline_js = <<<EOD 
  8. jQuery(function() { 
  9. moment.locale( '{$moment_locale}' ); 
  10. }); 
  11. EOD; 
  12.  
  13. return $inline_js;