functions.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * Pendant functions and definitions
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6. *
  7. * @package Pendant
  8. * @since Pendant 1.0
  9. */
  10. if ( ! function_exists( 'pendant_support' ) ) :
  11. /**
  12. * Sets up theme defaults and registers support for various WordPress features.
  13. *
  14. * @since Block Canvas 1.0
  15. *
  16. * @return void
  17. */
  18. function pendant_support() {
  19. // Add support for block styles.
  20. add_theme_support( 'wp-block-styles' );
  21. // Enqueue editor styles.
  22. add_editor_style( 'style.css' );
  23. }
  24. endif;
  25. add_action( 'after_setup_theme', 'pendant_support' );
  26. if ( ! function_exists( 'pendant_styles' ) ) :
  27. /**
  28. * Enqueue styles.
  29. *
  30. * @since Block Canvas 1.0
  31. *
  32. * @return void
  33. */
  34. function pendant_styles() {
  35. // Register theme stylesheet.
  36. wp_register_style(
  37. 'pendant-style',
  38. get_template_directory_uri() . '/style.css',
  39. array(),
  40. wp_get_theme()->get( 'Version' )
  41. );
  42. // Enqueue theme stylesheet.
  43. wp_enqueue_style( 'pendant-style' );
  44. }
  45. endif;
  46. add_action( 'wp_enqueue_scripts', 'pendant_styles' );
  47. function pendant_register_block_pattern_categories() {
  48. register_block_pattern_category( 'featured', array( 'label' => __( 'Featured', 'pendant' ) ) );
  49. register_block_pattern_category( 'query', array( 'label' => __( 'Query', 'pendant' ) ) );
  50. register_block_pattern_category( 'call-to-action', array( 'label' => __( 'Call to Action', 'pendant' ) ) );
  51. register_block_pattern_category( 'media', array( 'label' => __( 'Media', 'pendant' ) ) );
  52. register_block_pattern_category( 'quotes', array( 'label' => __( 'Quotes', 'pendant' ) ) );
  53. register_block_pattern_category( 'list', array( 'label' => __( 'List', 'pendant' ) ) );
  54. register_block_pattern_category( 'images', array( 'label' => __( 'Images', 'pendant' ) ) );
  55. register_block_pattern_category( 'gallery', array( 'label' => __( 'Gallery', 'pendant' ) ) );
  56. }
  57. add_action( 'init', 'pendant_register_block_pattern_categories', 9 );