%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/sitemap225.xml
2026-12-01
https://louisvillegop.com/sitemap564.xml
2026-12-01
https://louisvillegop.com/sitemap165.xml
2026-12-01
https://louisvillegop.com/sitemap980.xml
2026-12-01
https://louisvillegop.com/sitemap860.xml
2026-12-01
https://louisvillegop.com/sitemap656.xml
2026-12-01
https://louisvillegop.com/sitemap411.xml
2026-12-01
https://louisvillegop.com/sitemap3.xml
2026-12-01
https://louisvillegop.com/sitemap985.xml
2026-12-01
https://louisvillegop.com/sitemap612.xml
2026-12-01
https://louisvillegop.com/sitemap210.xml
2026-12-01
https://louisvillegop.com/sitemap435.xml
2026-12-01
https://louisvillegop.com/sitemap339.xml
2026-12-01
https://louisvillegop.com/sitemap322.xml
2026-12-01
https://louisvillegop.com/sitemap162.xml
2026-12-01
https://louisvillegop.com/sitemap789.xml
2026-12-01
https://louisvillegop.com/sitemap655.xml
2026-12-01
https://louisvillegop.com/sitemap247.xml
2026-12-01
https://louisvillegop.com/sitemap518.xml
2026-12-01
https://louisvillegop.com/sitemap850.xml
2026-12-01
https://louisvillegop.com/sitemap213.xml
2026-12-01
https://louisvillegop.com/sitemap526.xml
2026-12-01
https://louisvillegop.com/sitemap204.xml
2026-12-01
https://louisvillegop.com/sitemap318.xml
2026-12-01
https://louisvillegop.com/sitemap749.xml
2026-12-01
https://louisvillegop.com/sitemap394.xml
2026-12-01
https://louisvillegop.com/sitemap311.xml
2026-12-01
https://louisvillegop.com/sitemap200.xml
2026-12-01
https://louisvillegop.com/sitemap268.xml
2026-12-01
https://louisvillegop.com/sitemap891.xml
2026-12-01
https://louisvillegop.com/sitemap579.xml
2026-12-01
https://louisvillegop.com/sitemap585.xml
2026-12-01
https://louisvillegop.com/sitemap23.xml
2026-12-01
https://louisvillegop.com/sitemap161.xml
2026-12-01
https://louisvillegop.com/sitemap147.xml
2026-12-01
https://louisvillegop.com/sitemap175.xml
2026-12-01
https://louisvillegop.com/sitemap490.xml
2026-12-01
https://louisvillegop.com/sitemap363.xml
2026-12-01
https://louisvillegop.com/sitemap402.xml
2026-12-01
https://louisvillegop.com/sitemap930.xml
2026-12-01
https://louisvillegop.com/sitemap856.xml
2026-12-01
https://louisvillegop.com/sitemap893.xml
2026-12-01
https://louisvillegop.com/sitemap713.xml
2026-12-01
https://louisvillegop.com/sitemap198.xml
2026-12-01
https://louisvillegop.com/sitemap301.xml
2026-12-01
https://louisvillegop.com/sitemap913.xml
2026-12-01
https://louisvillegop.com/sitemap729.xml
2026-12-01
https://louisvillegop.com/sitemap633.xml
2026-12-01
https://louisvillegop.com/sitemap691.xml
2026-12-01
https://louisvillegop.com/sitemap211.xml
2026-12-01
https://louisvillegop.com/sitemap894.xml
2026-12-01
https://louisvillegop.com/sitemap531.xml
2026-12-01
https://louisvillegop.com/sitemap777.xml
2026-12-01
https://louisvillegop.com/sitemap21.xml
2026-12-01
https://louisvillegop.com/sitemap840.xml
2026-12-01
https://louisvillegop.com/sitemap964.xml
2026-12-01
https://louisvillegop.com/sitemap616.xml
2026-12-01
https://louisvillegop.com/sitemap145.xml
2026-12-01
https://louisvillegop.com/sitemap898.xml
2026-12-01
https://louisvillegop.com/sitemap80.xml
2026-12-01
https://louisvillegop.com/sitemap422.xml
2026-12-01
https://louisvillegop.com/sitemap801.xml
2026-12-01
https://louisvillegop.com/sitemap818.xml
2026-12-01
https://louisvillegop.com/sitemap541.xml
2026-12-01
https://louisvillegop.com/sitemap736.xml
2026-12-01
https://louisvillegop.com/sitemap351.xml
2026-12-01
https://louisvillegop.com/sitemap620.xml
2026-12-01
https://louisvillegop.com/sitemap662.xml
2026-12-01
https://louisvillegop.com/sitemap899.xml
2026-12-01
https://louisvillegop.com/sitemap805.xml
2026-12-01