functions.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Feelin' Good functions and definitions
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6. *
  7. * @package Feelin' Good
  8. * @since Feelin' Good 1.0
  9. */
  10. declare( strict_types = 1 );
  11. if ( ! function_exists( 'feelingood_support' ) ) :
  12. /**
  13. * Sets up theme defaults and registers support for various WordPress functionalities.
  14. *
  15. * @since Feelin' Good 1.0
  16. *
  17. * @return void
  18. */
  19. function feelingood_support() {
  20. // Enqueue editor styles.
  21. add_editor_style( 'style.css' );
  22. // Make theme available for translation.
  23. load_theme_textdomain( 'feelingood' );
  24. }
  25. endif;
  26. add_action( 'after_setup_theme', 'feelingood_support' );
  27. if ( ! function_exists( 'feelingood_styles' ) ) :
  28. /**
  29. * Enqueue styles.
  30. *
  31. * @since Feelin' Good 1.0
  32. *
  33. * @return void
  34. */
  35. function feelingood_styles() {
  36. // Register theme stylesheet.
  37. wp_register_style(
  38. 'feelingood-style',
  39. get_stylesheet_directory_uri() . '/style.css',
  40. array(),
  41. wp_get_theme()->get( 'Version' )
  42. );
  43. // Enqueue theme stylesheet.
  44. wp_enqueue_style( 'feelingood-style' );
  45. }
  46. endif;
  47. add_action( 'wp_enqueue_scripts', 'feelingood_styles' );
  48. /**
  49. * Temporaly fix for disabling the default font sizes.
  50. * https://github.com/WordPress/gutenberg/issues/52200
  51. *
  52. * @since Feelin' Good 1.0
  53. *
  54. * @return void
  55. */
  56. add_filter( 'wp_theme_json_data_default', function( $theme_json ) {
  57. $data = [
  58. 'version' => 2,
  59. 'settings' => [
  60. 'typography' => [
  61. 'fontSizes' => []
  62. ]
  63. ]
  64. ];
  65. return $theme_json->update_with( $data );
  66. } );