block-patterns.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Geologist Theme: Block Patterns
  4. *
  5. * @package Geologist
  6. * @since 1.0.0
  7. */
  8. if ( ! function_exists( 'geologist_register_block_patterns' ) ) :
  9. function geologist_register_block_patterns() {
  10. if ( function_exists( 'register_block_pattern_category' ) ) {
  11. register_block_pattern_category(
  12. 'geologist',
  13. array( 'label' => __( 'Geologist', 'geologist' ) )
  14. );
  15. }
  16. if ( function_exists( 'register_block_pattern' ) ) {
  17. $block_patterns = array(
  18. 'authors',
  19. 'header-with-rounded-site-logo',
  20. 'image-feature',
  21. 'introduction',
  22. 'quote',
  23. 'two-featured-posts',
  24. );
  25. if ( class_exists( 'WP_Block_Type_Registry' ) && \WP_Block_Type_Registry::get_instance()->is_registered( 'jetpack/subscriptions' ) ) {
  26. $block_patterns[] = 'email-updates-large';
  27. $block_patterns[] = 'email-updates-small';
  28. }
  29. foreach ( $block_patterns as $block_pattern ) {
  30. register_block_pattern(
  31. 'geologist/' . $block_pattern,
  32. require __DIR__ . '/patterns/' . $block_pattern . '.php'
  33. );
  34. }
  35. }
  36. }
  37. endif;
  38. add_action( 'init', 'geologist_register_block_patterns', 9 );