wpcom.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * WordPress.com-specific functions and definitions
  4. * This file is centrally included from `wp-content/mu-plugins/wpcom-theme-compat.php`.
  5. *
  6. * @package Button 2
  7. */
  8. /**
  9. * Adds support for WP.com print styles and responsive videos
  10. */
  11. function button_2_theme_support() {
  12. global $themecolors;
  13. /**
  14. * Set a default theme color array for WP.com.
  15. *
  16. * @global array $themecolors
  17. */
  18. if ( ! isset( $themecolors ) ) :
  19. $themecolors = array(
  20. 'bg' => 'ffffff',
  21. 'border' => 'eeeeee',
  22. 'text' => '888888',
  23. 'link' => 'f78769',
  24. 'url' => 'f78769',
  25. );
  26. endif;
  27. add_theme_support( 'print-style' );
  28. }
  29. add_action( 'after_setup_theme', 'button_2_theme_support' );
  30. /*
  31. * De-queue Google fonts if custom fonts are being used instead
  32. */
  33. function button_2_dequeue_fonts() {
  34. if ( class_exists( 'TypekitData' ) && class_exists( 'CustomDesign' ) && CustomDesign::is_upgrade_active() ) {
  35. $customfonts = TypekitData::get( 'families' );
  36. if ( $customfonts && $customfonts['site-title']['id'] && $customfonts['headings']['id'] && $customfonts['body-text']['id'] ) {
  37. wp_dequeue_style( 'button-2-fonts' );
  38. }
  39. }
  40. }
  41. add_action( 'wp_enqueue_scripts', 'button_2_dequeue_fonts' );
  42. //WordPress.com specific styles
  43. function button_2_wpcom_styles() {
  44. wp_enqueue_style( 'button-2-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20170303' );
  45. }
  46. add_action( 'wp_enqueue_scripts', 'button_2_wpcom_styles' );