Нема описа

devicepx.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Loads the devicepx library which improves the resolution of gravatars and
  4. * wordpress.com uploads on hi-res and zoomed browsers.
  5. *
  6. * This feature will only be activated for themes that declare their support.
  7. * This can be done by adding code similar to the following during the
  8. * 'after_setup_theme' action:
  9. *
  10. * add_theme_support( 'jetpack-devicepx' );
  11. *
  12. * @package automattic/jetpack
  13. */
  14. /**
  15. * Enqueue the devicepx JS library, if enabled. The feature must
  16. * be enabled earlier during `after_setup_theme`.
  17. *
  18. * @uses current_theme_supports, add_action
  19. */
  20. function jetpack_devicepx_init() {
  21. if ( current_theme_supports( 'jetpack-devicepx' ) ) {
  22. add_action( 'wp_enqueue_scripts', 'jetpack_devicepx_enqueue' );
  23. add_action( 'customize_controls_enqueue_scripts', 'jetpack_devicepx_enqueue' );
  24. add_action( 'admin_enqueue_scripts', 'jetpack_devicepx_enqueue' );
  25. }
  26. }
  27. // Use a late priority to ensure that plugins and themes can enable or disable this feature.
  28. add_action( 'init', 'jetpack_devicepx_init', 99 );
  29. /**
  30. * Enqueue the devicepx JS library.
  31. *
  32. * @uses wp_enqueue_script
  33. */
  34. function jetpack_devicepx_enqueue() {
  35. wp_enqueue_script( 'devicepx', 'https://s0.wp.com/wp-content/js/devicepx-jetpack.js', array(), gmdate( 'oW' ), true );
  36. }