functions.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Loudness functions and definitions
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6. *
  7. * @package Loudness
  8. * @since Loudness 1.0
  9. */
  10. if ( ! function_exists( 'loudness_support' ) ) :
  11. /**
  12. * Sets up theme defaults and registers support for various WordPress features.
  13. *
  14. * @since Loudness 1.0
  15. *
  16. * @return void
  17. */
  18. function loudness_support() {
  19. // Enqueue editor styles.
  20. add_editor_style( 'style.css' );
  21. // Make theme available for translation.
  22. load_theme_textdomain( 'loudness' );
  23. }
  24. endif;
  25. add_action( 'after_setup_theme', 'loudness_support' );
  26. if ( ! function_exists( 'loudness_styles' ) ) :
  27. /**
  28. * Enqueue styles.
  29. *
  30. * @since Loudness 1.0
  31. *
  32. * @return void
  33. */
  34. function loudness_styles() {
  35. // Register theme stylesheet.
  36. wp_register_style(
  37. 'loudness-style',
  38. get_stylesheet_directory_uri() . '/style.css',
  39. array(),
  40. wp_get_theme()->get( 'Version' )
  41. );
  42. // Enqueue theme stylesheet.
  43. wp_enqueue_style( 'loudness-style' );
  44. }
  45. endif;
  46. add_action( 'wp_enqueue_scripts', 'loudness_styles' );
  47. function loudness_init() {
  48. if ( ! WP_Block_Pattern_Categories_Registry::get_instance()->is_registered( 'illustrations' ) ) {
  49. register_block_pattern_category( 'illustrations', array( 'label' => __( 'Illustrations', 'loudness' ) ) );
  50. }
  51. register_block_style(
  52. 'core/navigation-link',
  53. array(
  54. 'name' => 'navigation-link-button',
  55. 'label' => __( 'Button', 'loudness' ),
  56. )
  57. );
  58. }
  59. add_action( 'init', 'loudness_init' );