wpcom.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * WordPress.com-specific functions and definitions.
  4. *
  5. * This file is centrally included from `wp-content/mu-plugins/wpcom-theme-compat.php`.
  6. *
  7. * @package Scratchpad
  8. */
  9. /**
  10. * Adds support for wp.com-specific theme functions.
  11. *
  12. * @global array $themecolors
  13. */
  14. function scratchpad_wpcom_setup() {
  15. global $themecolors;
  16. // Set theme colors for third party services.
  17. if ( ! isset( $themecolors ) ) {
  18. $themecolors = array(
  19. 'bg' => 'ffffff',
  20. 'border' => 'dddddd',
  21. 'text' => '777777',
  22. 'link' => '537375',
  23. 'url' => '537375',
  24. );
  25. }
  26. }
  27. add_action( 'after_setup_theme', 'scratchpad_wpcom_setup' );
  28. /**
  29. * De-queue Google fonts if custom fonts are being used instead.
  30. *
  31. * @return void
  32. */
  33. function scratchpad_dequeue_fonts() {
  34. if ( class_exists( 'TypekitData' ) && class_exists( 'CustomDesign' ) && CustomDesign::is_upgrade_active() ) {
  35. $custom_fonts = TypekitData::get( 'families' );
  36. if ( $custom_fonts && $custom_fonts['headings']['id'] && $custom_fonts['body-text']['id'] ) {
  37. wp_dequeue_style( 'scratchpad-fonts' );
  38. }
  39. }
  40. }
  41. add_action( 'wp_enqueue_scripts', 'scratchpad_dequeue_fonts' );