wpcom.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 Gazette
  8. */
  9. /**
  10. * Adds support for wp.com-specific theme functions.
  11. *
  12. * @global array $themecolors
  13. */
  14. function gazette_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' => '222222',
  22. 'link' => '3863c1',
  23. 'url' => '3863c1',
  24. );
  25. }
  26. // Add print stylesheet.
  27. add_theme_support( 'print-style' );
  28. }
  29. add_action( 'after_setup_theme', 'gazette_wpcom_setup' );
  30. /**
  31. * Enqueue wp.com-specific styles
  32. */
  33. function gazette_wpcom_styles() {
  34. wp_enqueue_style( 'gazette-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20150423' );
  35. }
  36. add_action( 'wp_enqueue_scripts', 'gazette_wpcom_styles' );
  37. /**
  38. * De-queue Google fonts if custom fonts are being used instead.
  39. */
  40. function gazette_dequeue_fonts() {
  41. if ( class_exists( 'TypekitData' ) && class_exists( 'CustomDesign' ) && CustomDesign::is_upgrade_active() ) {
  42. $customfonts = TypekitData::get( 'families' );
  43. if ( $customfonts['headings']['id'] && $customfonts['body-text']['id'] ) {
  44. wp_dequeue_style( 'gazette-lora' );
  45. }
  46. }
  47. }
  48. add_action( 'wp_enqueue_scripts', 'gazette_dequeue_fonts' );
  49. /**
  50. * Remove the widont filter.
  51. */
  52. function gazette_wido() {
  53. remove_filter( 'the_title', 'widont' );
  54. }
  55. add_action( 'init', 'gazette_wido' );