init.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /**
  3. * Gutenberg theme support.
  4. *
  5. * @package Captivating
  6. * @author Lauren Gaige // Restored 316 LLC
  7. * @license GPL-2.0-or-later
  8. * @link https://www.restored316designs.com/themes
  9. */
  10. add_action( 'wp_enqueue_scripts', 'captivating_enqueue_gutenberg_frontend_styles' );
  11. /**
  12. * Enqueues Gutenberg front-end styles.
  13. *
  14. * @since 2.7.0
  15. */
  16. function captivating_enqueue_gutenberg_frontend_styles() {
  17. $child_theme_slug = defined( 'CHILD_THEME_NAME' ) && CHILD_THEME_NAME ? sanitize_title_with_dashes( CHILD_THEME_NAME ) : 'captivating';
  18. wp_enqueue_style(
  19. 'captivating-gutenberg',
  20. get_stylesheet_directory_uri() . '/lib/gutenberg/front-end.css',
  21. array( $child_theme_slug ),
  22. CHILD_THEME_VERSION
  23. );
  24. }
  25. add_action( 'enqueue_block_editor_assets', 'captivating_block_editor_styles' );
  26. /**
  27. * Enqueues Gutenberg admin editor fonts and styles.
  28. *
  29. * @since 2.7.0
  30. */
  31. function captivating_block_editor_styles() {
  32. wp_enqueue_style(
  33. 'captivating-gutenberg-fonts',
  34. 'https://fonts.googleapis.com/css?family=Montserrat:300,300i,400,700,700i|Open+Sans:400,400i,700,700i|Playfair+Display:400,400i,700,700i|Poppins',
  35. array(),
  36. CHILD_THEME_VERSION
  37. );
  38. }
  39. // Add support for editor styles.
  40. add_theme_support( 'editor-styles' );
  41. // Enqueue editor styles.
  42. add_editor_style( '/lib/gutenberg/style-editor.css' );
  43. // Adds support for block alignments.
  44. add_theme_support( 'align-wide' );
  45. // Make media embeds responsive.
  46. add_theme_support( 'responsive-embeds' );
  47. // Adds support for editor font sizes.
  48. add_theme_support(
  49. 'editor-font-sizes',
  50. array(
  51. array(
  52. 'name' => __( 'Small', 'captivating' ),
  53. 'shortName' => __( 'S', 'captivating' ),
  54. 'size' => 12,
  55. 'slug' => 'small',
  56. ),
  57. array(
  58. 'name' => __( 'Normal', 'captivating' ),
  59. 'shortName' => __( 'M', 'captivating' ),
  60. 'size' => 16,
  61. 'slug' => 'normal',
  62. ),
  63. array(
  64. 'name' => __( 'Large', 'captivating' ),
  65. 'shortName' => __( 'L', 'captivating' ),
  66. 'size' => 20,
  67. 'slug' => 'large',
  68. ),
  69. array(
  70. 'name' => __( 'Larger', 'captivating' ),
  71. 'shortName' => __( 'XL', 'captivating' ),
  72. 'size' => 24,
  73. 'slug' => 'larger',
  74. ),
  75. )
  76. );
  77. add_action( 'after_setup_theme', 'captivating_content_width', 0 );
  78. /**
  79. * Set content width to match the “wide” Gutenberg block width.
  80. */
  81. function captivating_content_width() {
  82. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/924
  83. $GLOBALS['content_width'] = apply_filters( 'captivating_content_width', 1062 );
  84. }