wpcom.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <?php
  2. /**
  3. * WordPress.com-specific functions and definitions.
  4. *
  5. * This file is centrally included from `wp-content/mu-plugins/wpcom-theme-compat.php`.
  6. *
  7. * @package Blank Canvas
  8. */
  9. /**
  10. * Remove setting for hiding page title on the homepage.
  11. */
  12. function blank_canvas_wpcom_customize_update( $wp_customize ) {
  13. $wp_customize->remove_control( 'hide_front_page_title');
  14. }
  15. add_action( 'customize_register', 'blank_canvas_wpcom_customize_update', 11 );
  16. /**
  17. * Enqueue CSS for Customizer message.
  18. */
  19. function blank_canvas_customizer_enqueue() {
  20. wp_enqueue_style( 'blank-canvas-customizer-style', get_stylesheet_directory_uri() . '/inc/wpcom-customizer.css', array(), wp_get_theme()->get( 'Version' ) );
  21. }
  22. add_action( 'customize_controls_enqueue_scripts', 'blank_canvas_customizer_enqueue' );
  23. /**
  24. * Register WP.com-only block patterns.
  25. */
  26. if ( ! function_exists( 'blank_canvas_register_wpcom_block_patterns' ) ) :
  27. function blank_canvas_register_wpcom_block_patterns() {
  28. if ( function_exists( 'register_block_pattern' ) ) {
  29. /* This pattern is WP.com-only because it relies on the Layout Grid block. */
  30. register_block_pattern(
  31. 'blank-canvas/card',
  32. array(
  33. 'title' => __( 'Card', 'blank-canvas' ),
  34. 'categories' => array( 'blank-canvas' ),
  35. 'content' => '<!-- wp:jetpack/layout-grid {"column1DesktopSpan":4,"column1DesktopOffset":4,"column1TabletSpan":4,"column1TabletOffset":2,"column1MobileSpan":4,"column2DesktopOffset":8,"column2TabletOffset":13,"className":"column1-desktop-grid__span-4 column1-desktop-grid__start-5 column1-desktop-grid__row-1 column1-tablet-grid__span-4 column1-tablet-grid__start-3 column1-tablet-grid__row-1 column1-mobile-grid__span-4 column1-mobile-grid__row-1"} -->
  36. <div class="wp-block-jetpack-layout-grid alignfull column1-desktop-grid__span-4 column1-desktop-grid__start-5 column1-desktop-grid__row-1 column1-tablet-grid__span-4 column1-tablet-grid__start-3 column1-tablet-grid__row-1 column1-mobile-grid__span-4 column1-mobile-grid__row-1"><!-- wp:jetpack/layout-grid-column -->
  37. <div class="wp-block-jetpack-layout-grid-column wp-block-jetpack-layout-grid__padding-none"><!-- wp:image {"id":16,"sizeSlug":"large","linkDestination":"none","className":"margin-bottom-none"} -->
  38. <figure class="wp-block-image size-large margin-bottom-none"><img src="' . esc_url( get_stylesheet_directory_uri() . '/assets/pattern-portrait.jpg' ) . '" alt="'. esc_attr__( 'Portrait of a woman against a pink and blue background.', 'blank-canvas' ) . '"/></figure>
  39. <!-- /wp:image -->
  40. <!-- wp:group {"className":"margin-top-none","style":{"color":{"background":"#ebfbff"}}} -->
  41. <div class="wp-block-group margin-top-none has-background" style="background-color:#ebfbff"><div class="wp-block-group__inner-container"><!-- wp:heading {"level":1,"className":"margin-bottom-none","textColor":"primary","style":{"typography":{"fontSize":"32px"}}} -->
  42. <h1 class="margin-bottom-none has-primary-color has-text-color" style="font-size:32px"><strong>' . __( 'Kate Adams', 'blank-canvas' ) . '</strong></h1>
  43. <!-- /wp:heading -->
  44. <!-- wp:paragraph {"className":"margin-top-half","textColor":"primary","style":{"typography":{"fontSize":"18px"}}} -->
  45. <p class="margin-top-half has-primary-color has-text-color" style="font-size:18px">'. esc_html__( 'Hi! I’m a lead strategist for growing sustainable revenue streams for integrated fundraising.', 'blank-canvas' ) . '</p>
  46. <!-- /wp:paragraph -->
  47. <!-- wp:buttons {"contentJustification":"center"} -->
  48. <div class="wp-block-buttons is-content-justification-center"><!-- wp:button {"borderRadius":4,"style":{"color":{"text":"#ffffff","background":"#067eb1"}}} -->
  49. <div class="wp-block-button"><a class="wp-block-button__link has-text-color has-background" style="border-radius:4px;background-color:#067eb1;color:#ffffff">'. esc_html__( 'Get in touch', 'blank-canvas' ) . '</a></div>
  50. <!-- /wp:button --></div>
  51. <!-- /wp:buttons -->
  52. <!-- wp:social-links {"align":"center"} -->
  53. <ul class="wp-block-social-links aligncenter"><!-- wp:social-link {"url":"https://linkedin.com/","service":"linkedin"} /-->
  54. <!-- wp:social-link {"url":"https://twitter.com/","service":"twitter"} /-->
  55. <!-- wp:social-link {"url":"https://instagram.com/","service":"instagram"} /--></ul>
  56. <!-- /wp:social-links --></div></div>
  57. <!-- /wp:group --></div>
  58. <!-- /wp:jetpack/layout-grid-column --></div>
  59. <!-- /wp:jetpack/layout-grid -->',
  60. )
  61. );
  62. /* This pattern is WP.com-only because it relies on the Contact Form block. */
  63. register_block_pattern(
  64. 'blank-canvas/email-signup',
  65. array(
  66. 'title' => __( 'Email Signup', 'blank-canvas' ),
  67. 'categories' => array( 'blank-canvas' ),
  68. 'content' => '<!-- wp:cover {"url":"' . esc_url( get_stylesheet_directory_uri() . '/assets/pattern-art.jpg' ) . '","id":1934,"dimRatio":60,"overlayColor":"secondary","minHeight":100,"minHeightUnit":"vh","contentPosition":"top left","align":"full"} -->
  69. <div class="wp-block-cover alignfull has-background-dim-60 has-secondary-background-color has-background-dim has-custom-content-position is-position-top-left" style="background-image:url(' . esc_url( get_stylesheet_directory_uri() . '/assets/pattern-art.jpg' ) . ');min-height:100vh"><div class="wp-block-cover__inner-container"><!-- wp:columns -->
  70. <div class="wp-block-columns"><!-- wp:column {"width":"5%"} -->
  71. <div class="wp-block-column" style="flex-basis:5%"></div>
  72. <!-- /wp:column -->
  73. <!-- wp:column {"width":50} -->
  74. <div class="wp-block-column" style="flex-basis:50%"><!-- wp:spacer {"height":10} -->
  75. <div style="height:10px" aria-hidden="true" class="wp-block-spacer"></div>
  76. <!-- /wp:spacer -->
  77. <!-- wp:heading {"level":1,"style":{"typography":{"fontSize":"32px"}}} -->
  78. <h1 style="font-size:32px"><strong>'. esc_html__( 'Virtual Art Classes', 'blank-canvas' ) . '</strong></h1>
  79. <!-- /wp:heading -->
  80. <!-- wp:paragraph -->
  81. <p>'. esc_html__( 'Join instructor Jaime Adams for a series of virtual classes aimed at helping you hone your drawing skills. We will focus on composition, perspective, contour, representing volume, and more!', 'blank-canvas' ) . '</p>
  82. <!-- /wp:paragraph -->
  83. <!-- wp:jetpack/contact-form -->
  84. <!-- wp:jetpack/field-email {"required":true,"options":[]} /-->
  85. <!-- wp:jetpack/button {"element":"button","text":"'. esc_html__( 'Learn More', 'blank-canvas' ) . '","textColor":"secondary","backgroundColor":"background"} /-->
  86. <!-- /wp:jetpack/contact-form --></div>
  87. <!-- /wp:column --></div>
  88. <!-- /wp:columns --></div></div>
  89. <!-- /wp:cover -->',
  90. )
  91. );
  92. /* This pattern is WP.com-only because it relies on the Jetpack Subscription block. */
  93. register_block_pattern(
  94. 'blank-canvas/links-subscription-form',
  95. array(
  96. 'title' => __( 'Subscription Form and Links', 'blank-canvas' ),
  97. 'categories' => array( 'link-in-bio' ),
  98. 'content' => '<!-- wp:cover {"url":"' . esc_url( get_stylesheet_directory_uri() . '/assets/pattern-noise.gif' ) . '","id":84,"hasParallax":true,"dimRatio":0,"overlayColor":"primary","minHeight":100,"minHeightUnit":"vh","align":"full"} -->
  99. <div class="wp-block-cover alignfull has-primary-background-color has-parallax" style="background-image:url(' . esc_url( get_stylesheet_directory_uri() . '/assets/pattern-noise.gif' ) . ');min-height:100vh"><div class="wp-block-cover__inner-container"><!-- wp:spacer {"height":20} -->
  100. <div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>
  101. <!-- /wp:spacer -->
  102. <!-- wp:image {"align":"center","id":71,"width":120,"height":120,"sizeSlug":"large","linkDestination":"none","className":"is-style-rounded"} -->
  103. <div class="wp-block-image is-style-rounded"><figure class="aligncenter size-large is-resized"><img src="' . esc_url( get_stylesheet_directory_uri() . '/assets/pattern-guitar.jpg' ) . '" alt="'. esc_attr__( 'Image of a man with a guitar.', 'blank-canvas' ) . '" class="wp-image-71" width="120" height="120"/></figure></div>
  104. <!-- /wp:image -->
  105. <!-- wp:heading {"textAlign":"center","level":1,"textColor":"background"} -->
  106. <h1 class="has-text-align-center has-background-color has-text-color"><strong>'. esc_html__( 'Narrow Dog', 'blank-canvas' ) . '</strong></h1>
  107. <!-- /wp:heading -->
  108. <!-- wp:paragraph {"align":"center","textColor":"background"} -->
  109. <p class="has-text-align-center has-background-color has-text-color"><em>'. esc_html__( 'Noise Rock from Milwaukee, WI', 'blank-canvas' ) . '</em></p>
  110. <!-- /wp:paragraph -->
  111. <!-- wp:spacer {"height":1} -->
  112. <div style="height:1px" aria-hidden="true" class="wp-block-spacer"></div>
  113. <!-- /wp:spacer -->
  114. <!-- wp:jetpack/subscriptions {"buttonBackgroundColor":"background","textColor":"primary"} -->
  115. <div class="wp-block-jetpack-subscriptions wp-block-jetpack-subscriptions__supports-newline">[jetpack_subscription_form show_subscribers_total="false" button_on_newline="false" custom_font_size="16" custom_border_radius="0" custom_border_weight="1" custom_padding="15" custom_spacing="10" submit_button_classes="has-text-color has-primary-color has-background has-background-background-color" email_field_classes="" show_only_email_and_button="true"]</div>
  116. <!-- /wp:jetpack/subscriptions -->
  117. <!-- wp:buttons {"contentJustification":"left"} -->
  118. <div class="wp-block-buttons is-content-justification-left"><!-- wp:button {"borderRadius":0,"backgroundColor":"background","width":50} -->
  119. <div class="wp-block-button has-custom-width wp-block-button__width-50"><a class="wp-block-button__link has-background-background-color has-background no-border-radius">'. esc_html__( 'Spotify', 'blank-canvas' ) . '</a></div>
  120. <!-- /wp:button -->
  121. <!-- wp:button {"borderRadius":0,"backgroundColor":"background","width":50} -->
  122. <div class="wp-block-button has-custom-width wp-block-button__width-50"><a class="wp-block-button__link has-background-background-color has-background no-border-radius">'. esc_html__( 'Bandcamp', 'blank-canvas' ) . '</a></div>
  123. <!-- /wp:button -->
  124. <!-- wp:button {"borderRadius":0,"backgroundColor":"background","width":50} -->
  125. <div class="wp-block-button has-custom-width wp-block-button__width-50"><a class="wp-block-button__link has-background-background-color has-background no-border-radius">'. esc_html__( 'Merch', 'blank-canvas' ) . '</a></div>
  126. <!-- /wp:button -->
  127. <!-- wp:button {"borderRadius":0,"backgroundColor":"background","width":50} -->
  128. <div class="wp-block-button has-custom-width wp-block-button__width-50"><a class="wp-block-button__link has-background-background-color has-background no-border-radius">'. esc_html__( 'Website', 'blank-canvas' ) . '</a></div>
  129. <!-- /wp:button --></div>
  130. <!-- /wp:buttons -->
  131. <!-- wp:spacer {"height":1} -->
  132. <div style="height:1px" aria-hidden="true" class="wp-block-spacer"></div>
  133. <!-- /wp:spacer -->
  134. <!-- wp:social-links {"align":"center","className":"is-style-default"} -->
  135. <ul class="wp-block-social-links aligncenter is-style-default"><!-- wp:social-link {"url":"https://spotify.com","service":"spotify"} /-->
  136. <!-- wp:social-link {"url":"https://soundcloud.com","service":"soundcloud"} /-->
  137. <!-- wp:social-link {"url":"https://apple.com/itunes","service":"chain"} /--></ul>
  138. <!-- /wp:social-links -->
  139. <!-- wp:spacer {"height":20} -->
  140. <div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>
  141. <!-- /wp:spacer --></div></div>
  142. <!-- /wp:cover -->',
  143. )
  144. );
  145. }
  146. }
  147. endif;
  148. add_action( 'after_setup_theme', 'blank_canvas_register_wpcom_block_patterns', 12 );