wpcom.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 Radcliffe 2
  8. */
  9. /**
  10. * Adds support for wp.com-specific theme functions.
  11. *
  12. * @global array $themecolors
  13. */
  14. function radcliffe_2_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' => '222222',
  21. 'text' => '222222',
  22. 'link' => 'ca2017',
  23. 'url' => 'ca2017',
  24. );
  25. }
  26. add_theme_support( 'print-styles' );
  27. }
  28. add_action( 'after_setup_theme', 'radcliffe_2_wpcom_setup' );
  29. /*
  30. * De-queue Google fonts if custom fonts are being used instead
  31. */
  32. function radcliffe_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( 'radcliffe-2-fonts' );
  37. }
  38. }
  39. }
  40. add_action( 'wp_enqueue_scripts', 'radcliffe_2_dequeue_fonts' );
  41. /**
  42. * Enqueue WordPress.com-specific styles.
  43. */
  44. function radcliffe_2_wpcom_styles() {
  45. wp_enqueue_style( 'radcliffe-2-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20170718' );
  46. }
  47. add_action( 'wp_enqueue_scripts', 'radcliffe_2_wpcom_styles' );
  48. if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) :
  49. /**
  50. * WordPress.com-specific.
  51. * Track the clicks for certain theme features.
  52. */
  53. function radcliffe_2_wpcom_customize_controls_js() {
  54. if ( is_automattician() ) {
  55. return;
  56. }
  57. wp_enqueue_script( 'radcliffe-2-wpcom-customizer', get_template_directory_uri() . '/inc/wpcom-customizer.js', array( 'jquery', 'customize-controls' ), '1.0', true );
  58. }
  59. add_action( 'customize_controls_enqueue_scripts', 'radcliffe_2_wpcom_customize_controls_js' );
  60. endif;
  61. /**
  62. * Disabling Widont filter for titles
  63. */
  64. function radcliffe_2_wido() {
  65. remove_filter( 'the_title', 'widont' );
  66. }
  67. add_action( 'init', 'radcliffe_2_wido' );