wpcom.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 Penscratch 2
  8. */
  9. /**
  10. * Adds support for wp.com-specific theme functions.
  11. *
  12. * @global array $themecolors
  13. */
  14. function penscratch_2_wpcom_setup() {
  15. global $themecolors;
  16. // Set theme colors for third party services.
  17. if ( ! isset( $themecolors ) ) {
  18. $themecolors = array(
  19. 'bg' => 'eeeeee',
  20. 'border' => 'eeeeee',
  21. 'text' => '666666',
  22. 'link' => '1c7c7c',
  23. 'url' => '1c7c7c',
  24. );
  25. }
  26. add_theme_support( 'print-style' );
  27. }
  28. add_action( 'after_setup_theme', 'penscratch_2_wpcom_setup' );
  29. /*
  30. * De-queue Google fonts if custom fonts are being used instead
  31. */
  32. function penscratch_2_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( 'penscratch-2-fonts' );
  37. }
  38. }
  39. }
  40. add_action( 'wp_enqueue_scripts', 'penscratch_2_dequeue_fonts' );
  41. //WordPress.com specific styles
  42. function penscratch_2_wpcom_styles() {
  43. wp_enqueue_style( 'penscratch-2-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20160224' );
  44. }
  45. add_action( 'wp_enqueue_scripts', 'penscratch_2_wpcom_styles' );