wpcom.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 Karuna
  8. */
  9. /**
  10. * Adds support for wp.com-specific theme functions.
  11. *
  12. * @global array $themecolors
  13. */
  14. function karuna_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' => '333333',
  22. 'link' => '6636cc',
  23. 'url' => '6636cc',
  24. );
  25. }
  26. add_theme_support( 'print-styles' );
  27. }
  28. add_action( 'after_setup_theme', 'karuna_wpcom_setup' );
  29. /*
  30. * De-queue Google fonts if custom fonts are being used instead
  31. */
  32. function karuna_dequeue_fonts() {
  33. if ( class_exists( 'TypekitData' ) && class_exists( 'CustomDesign' ) && CustomDesign::is_upgrade_active() ) {
  34. $customfonts = TypekitData::get( 'families' );
  35. if ( $customfonts && $customfonts['site-title']['id'] && $customfonts['headings']['id'] && $customfonts['body-text']['id'] ) {
  36. wp_dequeue_style( 'karuna-fonts' );
  37. }
  38. }
  39. }
  40. add_action( 'wp_enqueue_scripts', 'karuna_dequeue_fonts' );
  41. //WordPress.com specific styles
  42. function karuna_wpcom_styles() {
  43. wp_enqueue_style( 'karuna-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20160607' );
  44. }
  45. add_action( 'wp_enqueue_scripts', 'karuna_wpcom_styles' );