wpcom.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 Libre 2
  7. */
  8. /**
  9. * Adds support for WP.com print styles and $themecolors
  10. */
  11. function libre_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' => '404040',
  22. 'text' => '404040',
  23. 'link' => '404040',
  24. 'url' => '404040',
  25. );
  26. endif;
  27. add_theme_support( 'print-style' );
  28. }
  29. add_action( 'after_setup_theme', 'libre_2_theme_support' );
  30. /*
  31. * De-queue Google fonts if custom fonts are being used instead
  32. */
  33. function libre_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( 'libre-2-fonts' );
  38. }
  39. }
  40. }
  41. add_action( 'wp_enqueue_scripts', 'libre_2_dequeue_fonts' );
  42. //WordPress.com specific styles
  43. function libre_2_wpcom_styles() {
  44. wp_enqueue_style( 'libre-2-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20150624' );
  45. }
  46. add_action( 'wp_head', 'libre_2_wpcom_styles', 2 );