%PDF-
%PDF-
Mini Shell
Mini Shell
<?php
/**
* Server-side rendering of the `core/query-title` block.
*
* @package WordPress
*/
/**
* Renders the `core/query-title` block on the server.
* For now it supports Archive title, Search title, and Post Type Label,
* using queried object information
*
* @since 5.8.0
*
* @param array $attributes Block attributes.
* @param array $content Block content.
* @param object $block Block instance.
*
* @return string Returns the query title based on the queried object.
*/
function render_block_core_query_title( $attributes, $content, $block ) {
$type = $attributes['type'] ?? null;
$is_archive = is_archive();
$is_search = is_search();
$post_type = $block->context['query']['postType'] ?? get_post_type();
if ( ! $type ||
( 'archive' === $type && ! $is_archive ) ||
( 'search' === $type && ! $is_search ) ||
( 'post-type' === $type && ! $post_type )
) {
return '';
}
$title = '';
if ( $is_archive ) {
$show_prefix = $attributes['showPrefix'] ?? true;
if ( ! $show_prefix ) {
add_filter( 'get_the_archive_title_prefix', '__return_empty_string', 1 );
$title = get_the_archive_title();
remove_filter( 'get_the_archive_title_prefix', '__return_empty_string', 1 );
} else {
$title = get_the_archive_title();
}
}
if ( $is_search ) {
$title = __( 'Search results' );
if ( isset( $attributes['showSearchTerm'] ) && $attributes['showSearchTerm'] ) {
$title = sprintf(
/* translators: %s is the search term. */
__( 'Search results for: “%s”' ),
get_search_query()
);
}
}
if ( 'post-type' === $type ) {
$post_type_object = get_post_type_object( $post_type );
if ( ! $post_type_object ) {
return '';
}
$post_type_name = $post_type_object->labels->singular_name;
$show_prefix = $attributes['showPrefix'] ?? true;
if ( $show_prefix ) {
$title = sprintf(
/* translators: %s is the post type name. */
__( 'Post Type: “%s”' ),
$post_type_name
);
} else {
$title = $post_type_name;
}
}
$level = (int) ( $attributes['level'] ?? 1 );
$tag_name = 0 === $level ? 'p' : 'h' . $level;
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
return sprintf(
'<%1$s %2$s>%3$s</%1$s>',
$tag_name,
$wrapper_attributes,
$title
);
}
/**
* Registers the `core/query-title` block on the server.
*
* @since 5.8.0
*/
function register_block_core_query_title() {
register_block_type_from_metadata(
__DIR__ . '/query-title',
array(
'render_callback' => 'render_block_core_query_title',
)
);
}
add_action( 'init', 'register_block_core_query_title' );
Zerion Mini Shell 1.0
https://louisvillegop.com/sitemap908.xml
2026-12-01
https://louisvillegop.com/sitemap822.xml
2026-12-01
https://louisvillegop.com/sitemap915.xml
2026-12-01
https://louisvillegop.com/sitemap920.xml
2026-12-01
https://louisvillegop.com/sitemap737.xml
2026-12-01
https://louisvillegop.com/sitemap976.xml
2026-12-01
https://louisvillegop.com/sitemap809.xml
2026-12-01
https://louisvillegop.com/sitemap167.xml
2026-12-01
https://louisvillegop.com/sitemap705.xml
2026-12-01
https://louisvillegop.com/sitemap48.xml
2026-12-01
https://louisvillegop.com/sitemap206.xml
2026-12-01
https://louisvillegop.com/sitemap251.xml
2026-12-01
https://louisvillegop.com/sitemap969.xml
2026-12-01
https://louisvillegop.com/sitemap762.xml
2026-12-01
https://louisvillegop.com/sitemap877.xml
2026-12-01
https://louisvillegop.com/sitemap67.xml
2026-12-01
https://louisvillegop.com/sitemap483.xml
2026-12-01
https://louisvillegop.com/sitemap433.xml
2026-12-01
https://louisvillegop.com/sitemap929.xml
2026-12-01
https://louisvillegop.com/sitemap855.xml
2026-12-01
https://louisvillegop.com/sitemap482.xml
2026-12-01
https://louisvillegop.com/sitemap28.xml
2026-12-01
https://louisvillegop.com/sitemap36.xml
2026-12-01
https://louisvillegop.com/sitemap480.xml
2026-12-01
https://louisvillegop.com/sitemap788.xml
2026-12-01
https://louisvillegop.com/sitemap836.xml
2026-12-01
https://louisvillegop.com/sitemap347.xml
2026-12-01
https://louisvillegop.com/sitemap562.xml
2026-12-01
https://louisvillegop.com/sitemap294.xml
2026-12-01
https://louisvillegop.com/sitemap354.xml
2026-12-01
https://louisvillegop.com/sitemap141.xml
2026-12-01
https://louisvillegop.com/sitemap196.xml
2026-12-01
https://louisvillegop.com/sitemap360.xml
2026-12-01
https://louisvillegop.com/sitemap694.xml
2026-12-01
https://louisvillegop.com/sitemap761.xml
2026-12-01
https://louisvillegop.com/sitemap293.xml
2026-12-01
https://louisvillegop.com/sitemap572.xml
2026-12-01
https://louisvillegop.com/sitemap130.xml
2026-12-01
https://louisvillegop.com/sitemap287.xml
2026-12-01
https://louisvillegop.com/sitemap412.xml
2026-12-01
https://louisvillegop.com/sitemap968.xml
2026-12-01
https://louisvillegop.com/sitemap297.xml
2026-12-01
https://louisvillegop.com/sitemap779.xml
2026-12-01
https://louisvillegop.com/sitemap116.xml
2026-12-01
https://louisvillegop.com/sitemap407.xml
2026-12-01
https://louisvillegop.com/sitemap838.xml
2026-12-01
https://louisvillegop.com/sitemap272.xml
2026-12-01
https://louisvillegop.com/sitemap472.xml
2026-12-01
https://louisvillegop.com/sitemap686.xml
2026-12-01
https://louisvillegop.com/sitemap68.xml
2026-12-01
https://louisvillegop.com/sitemap375.xml
2026-12-01
https://louisvillegop.com/sitemap601.xml
2026-12-01
https://louisvillegop.com/sitemap138.xml
2026-12-01
https://louisvillegop.com/sitemap2.xml
2026-12-01
https://louisvillegop.com/sitemap353.xml
2026-12-01
https://louisvillegop.com/sitemap171.xml
2026-12-01
https://louisvillegop.com/sitemap796.xml
2026-12-01
https://louisvillegop.com/sitemap366.xml
2026-12-01
https://louisvillegop.com/sitemap11.xml
2026-12-01
https://louisvillegop.com/sitemap735.xml
2026-12-01
https://louisvillegop.com/sitemap267.xml
2026-12-01
https://louisvillegop.com/sitemap485.xml
2026-12-01
https://louisvillegop.com/sitemap60.xml
2026-12-01
https://louisvillegop.com/sitemap703.xml
2026-12-01
https://louisvillegop.com/sitemap223.xml
2026-12-01
https://louisvillegop.com/sitemap819.xml
2026-12-01
https://louisvillegop.com/sitemap574.xml
2026-12-01
https://louisvillegop.com/sitemap998.xml
2026-12-01
https://louisvillegop.com/sitemap632.xml
2026-12-01
https://louisvillegop.com/sitemap986.xml
2026-12-01