[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/blocks/ -> site-tagline.php (source)

   1  <?php
   2  /**
   3   * Server-side rendering of the `core/site-tagline` block.
   4   *
   5   * @package WordPress
   6   */
   7  
   8  /**
   9   * Renders the `core/site-tagline` block on the server.
  10   *
  11   * @param array $attributes The block attributes.
  12   *
  13   * @return string The render.
  14   */
  15  function render_block_core_site_tagline( $attributes ) {
  16      $site_tagline = get_bloginfo( 'description' );
  17      if ( ! $site_tagline ) {
  18          return;
  19      }
  20      $align_class_name   = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
  21      $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
  22  
  23      return sprintf(
  24          '<p %1$s>%2$s</p>',
  25          $wrapper_attributes,
  26          $site_tagline
  27      );
  28  }
  29  
  30  /**
  31   * Registers the `core/site-tagline` block on the server.
  32   */
  33  function register_block_core_site_tagline() {
  34      register_block_type_from_metadata(
  35          __DIR__ . '/site-tagline',
  36          array(
  37              'render_callback' => 'render_block_core_site_tagline',
  38          )
  39      );
  40  }
  41  add_action( 'init', 'register_block_core_site_tagline' );


Generated: Thu Apr 18 01:00:02 2024 Cross-referenced by PHPXref 0.7.1