sharing_maybe_enqueue_scripts

The Jetpack by WordPress.com sharing maybe enqueue scripts function.

Description

sharing_maybe_enqueue_scripts(); 

Usage

  1. if ( !function_exists( 'sharing_maybe_enqueue_scripts' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/sharedaddy/sharing-service.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = sharing_maybe_enqueue_scripts(); 
  7.  

Defined (1)

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

/modules/sharedaddy/sharing-service.php  
  1. function sharing_maybe_enqueue_scripts() { 
  2. $sharer = new Sharing_Service(); 
  3. $global_options = $sharer->get_global_options(); 
  4.  
  5. $enqueue = false; 
  6. if ( is_singular() && in_array( get_post_type(), $global_options['show'] ) ) { 
  7. $enqueue = true; 
  8. } elseif ( in_array( 'index', $global_options['show'] ) && ( is_home() || is_front_page() || is_archive() || is_search() || in_array( get_post_type(), $global_options['show'] ) ) ) { 
  9. $enqueue = true; 
  10.  
  11. /** 
  12. * Filter to decide when sharing scripts should be enqueued. 
  13. * @module sharedaddy 
  14. * @since 3.2.0 
  15. * @param bool $enqueue Decide if the sharing scripts should be enqueued. 
  16. */ 
  17. return (bool) apply_filters( 'sharing_enqueue_scripts', $enqueue );