Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../public_h.../wp-inclu...
File: block-template-utils.php
* Returns an array containing the references of
[500] Fix | Delete
* the passed blocks and their inner blocks.
[501] Fix | Delete
*
[502] Fix | Delete
* @since 5.9.0
[503] Fix | Delete
* @access private
[504] Fix | Delete
*
[505] Fix | Delete
* @param array $blocks array of blocks.
[506] Fix | Delete
* @return array block references to the passed blocks and their inner blocks.
[507] Fix | Delete
*/
[508] Fix | Delete
function _flatten_blocks( &$blocks ) {
[509] Fix | Delete
$all_blocks = array();
[510] Fix | Delete
$queue = array();
[511] Fix | Delete
foreach ( $blocks as &$block ) {
[512] Fix | Delete
$queue[] = &$block;
[513] Fix | Delete
}
[514] Fix | Delete
[515] Fix | Delete
while ( count( $queue ) > 0 ) {
[516] Fix | Delete
$block = &$queue[0];
[517] Fix | Delete
array_shift( $queue );
[518] Fix | Delete
$all_blocks[] = &$block;
[519] Fix | Delete
[520] Fix | Delete
if ( ! empty( $block['innerBlocks'] ) ) {
[521] Fix | Delete
foreach ( $block['innerBlocks'] as &$inner_block ) {
[522] Fix | Delete
$queue[] = &$inner_block;
[523] Fix | Delete
}
[524] Fix | Delete
}
[525] Fix | Delete
}
[526] Fix | Delete
[527] Fix | Delete
return $all_blocks;
[528] Fix | Delete
}
[529] Fix | Delete
[530] Fix | Delete
/**
[531] Fix | Delete
* Injects the active theme's stylesheet as a `theme` attribute
[532] Fix | Delete
* into a given template part block.
[533] Fix | Delete
*
[534] Fix | Delete
* @since 6.4.0
[535] Fix | Delete
* @access private
[536] Fix | Delete
*
[537] Fix | Delete
* @param array $block a parsed block.
[538] Fix | Delete
*/
[539] Fix | Delete
function _inject_theme_attribute_in_template_part_block( &$block ) {
[540] Fix | Delete
if (
[541] Fix | Delete
'core/template-part' === $block['blockName'] &&
[542] Fix | Delete
! isset( $block['attrs']['theme'] )
[543] Fix | Delete
) {
[544] Fix | Delete
$block['attrs']['theme'] = get_stylesheet();
[545] Fix | Delete
}
[546] Fix | Delete
}
[547] Fix | Delete
[548] Fix | Delete
/**
[549] Fix | Delete
* Removes the `theme` attribute from a given template part block.
[550] Fix | Delete
*
[551] Fix | Delete
* @since 6.4.0
[552] Fix | Delete
* @access private
[553] Fix | Delete
*
[554] Fix | Delete
* @param array $block a parsed block.
[555] Fix | Delete
*/
[556] Fix | Delete
function _remove_theme_attribute_from_template_part_block( &$block ) {
[557] Fix | Delete
if (
[558] Fix | Delete
'core/template-part' === $block['blockName'] &&
[559] Fix | Delete
isset( $block['attrs']['theme'] )
[560] Fix | Delete
) {
[561] Fix | Delete
unset( $block['attrs']['theme'] );
[562] Fix | Delete
}
[563] Fix | Delete
}
[564] Fix | Delete
[565] Fix | Delete
/**
[566] Fix | Delete
* Builds a unified template object based on a theme file.
[567] Fix | Delete
*
[568] Fix | Delete
* @since 5.9.0
[569] Fix | Delete
* @since 6.3.0 Added `modified` property to template objects.
[570] Fix | Delete
* @access private
[571] Fix | Delete
*
[572] Fix | Delete
* @param array $template_file Theme file.
[573] Fix | Delete
* @param string $template_type Template type. Either 'wp_template' or 'wp_template_part'.
[574] Fix | Delete
* @return WP_Block_Template Template.
[575] Fix | Delete
*/
[576] Fix | Delete
function _build_block_template_result_from_file( $template_file, $template_type ) {
[577] Fix | Delete
$default_template_types = get_default_block_template_types();
[578] Fix | Delete
$theme = get_stylesheet();
[579] Fix | Delete
[580] Fix | Delete
$template = new WP_Block_Template();
[581] Fix | Delete
$template->id = $theme . '//' . $template_file['slug'];
[582] Fix | Delete
$template->theme = $theme;
[583] Fix | Delete
$template->content = file_get_contents( $template_file['path'] );
[584] Fix | Delete
$template->slug = $template_file['slug'];
[585] Fix | Delete
$template->source = 'theme';
[586] Fix | Delete
$template->type = $template_type;
[587] Fix | Delete
$template->title = ! empty( $template_file['title'] ) ? $template_file['title'] : $template_file['slug'];
[588] Fix | Delete
$template->status = 'publish';
[589] Fix | Delete
$template->has_theme_file = true;
[590] Fix | Delete
$template->is_custom = true;
[591] Fix | Delete
$template->modified = null;
[592] Fix | Delete
[593] Fix | Delete
if ( 'wp_template' === $template_type && isset( $default_template_types[ $template_file['slug'] ] ) ) {
[594] Fix | Delete
$template->description = $default_template_types[ $template_file['slug'] ]['description'];
[595] Fix | Delete
$template->title = $default_template_types[ $template_file['slug'] ]['title'];
[596] Fix | Delete
$template->is_custom = false;
[597] Fix | Delete
}
[598] Fix | Delete
[599] Fix | Delete
if ( 'wp_template' === $template_type && isset( $template_file['postTypes'] ) ) {
[600] Fix | Delete
$template->post_types = $template_file['postTypes'];
[601] Fix | Delete
}
[602] Fix | Delete
[603] Fix | Delete
if ( 'wp_template_part' === $template_type && isset( $template_file['area'] ) ) {
[604] Fix | Delete
$template->area = $template_file['area'];
[605] Fix | Delete
}
[606] Fix | Delete
[607] Fix | Delete
$before_block_visitor = '_inject_theme_attribute_in_template_part_block';
[608] Fix | Delete
$after_block_visitor = null;
[609] Fix | Delete
$hooked_blocks = get_hooked_blocks();
[610] Fix | Delete
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
[611] Fix | Delete
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
[612] Fix | Delete
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
[613] Fix | Delete
}
[614] Fix | Delete
$blocks = parse_blocks( $template->content );
[615] Fix | Delete
$template->content = traverse_and_serialize_blocks( $blocks, $before_block_visitor, $after_block_visitor );
[616] Fix | Delete
[617] Fix | Delete
return $template;
[618] Fix | Delete
}
[619] Fix | Delete
[620] Fix | Delete
/**
[621] Fix | Delete
* Builds the title and description of a post-specific template based on the underlying referenced post.
[622] Fix | Delete
*
[623] Fix | Delete
* Mutates the underlying template object.
[624] Fix | Delete
*
[625] Fix | Delete
* @since 6.1.0
[626] Fix | Delete
* @access private
[627] Fix | Delete
*
[628] Fix | Delete
* @param string $post_type Post type, e.g. page, post, product.
[629] Fix | Delete
* @param string $slug Slug of the post, e.g. a-story-about-shoes.
[630] Fix | Delete
* @param WP_Block_Template $template Template to mutate adding the description and title computed.
[631] Fix | Delete
* @return bool Returns true if the referenced post was found and false otherwise.
[632] Fix | Delete
*/
[633] Fix | Delete
function _wp_build_title_and_description_for_single_post_type_block_template( $post_type, $slug, WP_Block_Template $template ) {
[634] Fix | Delete
$post_type_object = get_post_type_object( $post_type );
[635] Fix | Delete
[636] Fix | Delete
$default_args = array(
[637] Fix | Delete
'post_type' => $post_type,
[638] Fix | Delete
'post_status' => 'publish',
[639] Fix | Delete
'posts_per_page' => 1,
[640] Fix | Delete
'update_post_meta_cache' => false,
[641] Fix | Delete
'update_post_term_cache' => false,
[642] Fix | Delete
'ignore_sticky_posts' => true,
[643] Fix | Delete
'no_found_rows' => true,
[644] Fix | Delete
);
[645] Fix | Delete
[646] Fix | Delete
$args = array(
[647] Fix | Delete
'name' => $slug,
[648] Fix | Delete
);
[649] Fix | Delete
$args = wp_parse_args( $args, $default_args );
[650] Fix | Delete
[651] Fix | Delete
$posts_query = new WP_Query( $args );
[652] Fix | Delete
[653] Fix | Delete
if ( empty( $posts_query->posts ) ) {
[654] Fix | Delete
$template->title = sprintf(
[655] Fix | Delete
/* translators: Custom template title in the Site Editor referencing a post that was not found. 1: Post type singular name, 2: Post type slug. */
[656] Fix | Delete
__( 'Not found: %1$s (%2$s)' ),
[657] Fix | Delete
$post_type_object->labels->singular_name,
[658] Fix | Delete
$slug
[659] Fix | Delete
);
[660] Fix | Delete
[661] Fix | Delete
return false;
[662] Fix | Delete
}
[663] Fix | Delete
[664] Fix | Delete
$post_title = $posts_query->posts[0]->post_title;
[665] Fix | Delete
[666] Fix | Delete
$template->title = sprintf(
[667] Fix | Delete
/* translators: Custom template title in the Site Editor. 1: Post type singular name, 2: Post title. */
[668] Fix | Delete
__( '%1$s: %2$s' ),
[669] Fix | Delete
$post_type_object->labels->singular_name,
[670] Fix | Delete
$post_title
[671] Fix | Delete
);
[672] Fix | Delete
[673] Fix | Delete
$template->description = sprintf(
[674] Fix | Delete
/* translators: Custom template description in the Site Editor. %s: Post title. */
[675] Fix | Delete
__( 'Template for %s' ),
[676] Fix | Delete
$post_title
[677] Fix | Delete
);
[678] Fix | Delete
[679] Fix | Delete
$args = array(
[680] Fix | Delete
'title' => $post_title,
[681] Fix | Delete
);
[682] Fix | Delete
$args = wp_parse_args( $args, $default_args );
[683] Fix | Delete
[684] Fix | Delete
$posts_with_same_title_query = new WP_Query( $args );
[685] Fix | Delete
[686] Fix | Delete
if ( count( $posts_with_same_title_query->posts ) > 1 ) {
[687] Fix | Delete
$template->title = sprintf(
[688] Fix | Delete
/* translators: Custom template title in the Site Editor. 1: Template title, 2: Post type slug. */
[689] Fix | Delete
__( '%1$s (%2$s)' ),
[690] Fix | Delete
$template->title,
[691] Fix | Delete
$slug
[692] Fix | Delete
);
[693] Fix | Delete
}
[694] Fix | Delete
[695] Fix | Delete
return true;
[696] Fix | Delete
}
[697] Fix | Delete
[698] Fix | Delete
/**
[699] Fix | Delete
* Builds the title and description of a taxonomy-specific template based on the underlying entity referenced.
[700] Fix | Delete
*
[701] Fix | Delete
* Mutates the underlying template object.
[702] Fix | Delete
*
[703] Fix | Delete
* @since 6.1.0
[704] Fix | Delete
* @access private
[705] Fix | Delete
*
[706] Fix | Delete
* @param string $taxonomy Identifier of the taxonomy, e.g. category.
[707] Fix | Delete
* @param string $slug Slug of the term, e.g. shoes.
[708] Fix | Delete
* @param WP_Block_Template $template Template to mutate adding the description and title computed.
[709] Fix | Delete
* @return bool True if the term referenced was found and false otherwise.
[710] Fix | Delete
*/
[711] Fix | Delete
function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy, $slug, WP_Block_Template $template ) {
[712] Fix | Delete
$taxonomy_object = get_taxonomy( $taxonomy );
[713] Fix | Delete
[714] Fix | Delete
$default_args = array(
[715] Fix | Delete
'taxonomy' => $taxonomy,
[716] Fix | Delete
'hide_empty' => false,
[717] Fix | Delete
'update_term_meta_cache' => false,
[718] Fix | Delete
);
[719] Fix | Delete
[720] Fix | Delete
$term_query = new WP_Term_Query();
[721] Fix | Delete
[722] Fix | Delete
$args = array(
[723] Fix | Delete
'number' => 1,
[724] Fix | Delete
'slug' => $slug,
[725] Fix | Delete
);
[726] Fix | Delete
$args = wp_parse_args( $args, $default_args );
[727] Fix | Delete
[728] Fix | Delete
$terms_query = $term_query->query( $args );
[729] Fix | Delete
[730] Fix | Delete
if ( empty( $terms_query ) ) {
[731] Fix | Delete
$template->title = sprintf(
[732] Fix | Delete
/* translators: Custom template title in the Site Editor, referencing a taxonomy term that was not found. 1: Taxonomy singular name, 2: Term slug. */
[733] Fix | Delete
__( 'Not found: %1$s (%2$s)' ),
[734] Fix | Delete
$taxonomy_object->labels->singular_name,
[735] Fix | Delete
$slug
[736] Fix | Delete
);
[737] Fix | Delete
return false;
[738] Fix | Delete
}
[739] Fix | Delete
[740] Fix | Delete
$term_title = $terms_query[0]->name;
[741] Fix | Delete
[742] Fix | Delete
$template->title = sprintf(
[743] Fix | Delete
/* translators: Custom template title in the Site Editor. 1: Taxonomy singular name, 2: Term title. */
[744] Fix | Delete
__( '%1$s: %2$s' ),
[745] Fix | Delete
$taxonomy_object->labels->singular_name,
[746] Fix | Delete
$term_title
[747] Fix | Delete
);
[748] Fix | Delete
[749] Fix | Delete
$template->description = sprintf(
[750] Fix | Delete
/* translators: Custom template description in the Site Editor. %s: Term title. */
[751] Fix | Delete
__( 'Template for %s' ),
[752] Fix | Delete
$term_title
[753] Fix | Delete
);
[754] Fix | Delete
[755] Fix | Delete
$term_query = new WP_Term_Query();
[756] Fix | Delete
[757] Fix | Delete
$args = array(
[758] Fix | Delete
'number' => 2,
[759] Fix | Delete
'name' => $term_title,
[760] Fix | Delete
);
[761] Fix | Delete
$args = wp_parse_args( $args, $default_args );
[762] Fix | Delete
[763] Fix | Delete
$terms_with_same_title_query = $term_query->query( $args );
[764] Fix | Delete
[765] Fix | Delete
if ( count( $terms_with_same_title_query ) > 1 ) {
[766] Fix | Delete
$template->title = sprintf(
[767] Fix | Delete
/* translators: Custom template title in the Site Editor. 1: Template title, 2: Term slug. */
[768] Fix | Delete
__( '%1$s (%2$s)' ),
[769] Fix | Delete
$template->title,
[770] Fix | Delete
$slug
[771] Fix | Delete
);
[772] Fix | Delete
}
[773] Fix | Delete
[774] Fix | Delete
return true;
[775] Fix | Delete
}
[776] Fix | Delete
[777] Fix | Delete
/**
[778] Fix | Delete
* Builds a block template object from a post object.
[779] Fix | Delete
*
[780] Fix | Delete
* This is a helper function that creates a block template object from a given post object.
[781] Fix | Delete
* It is self-sufficient in that it only uses information passed as arguments; it does not
[782] Fix | Delete
* query the database for additional information.
[783] Fix | Delete
*
[784] Fix | Delete
* @since 6.5.3
[785] Fix | Delete
* @access private
[786] Fix | Delete
*
[787] Fix | Delete
* @param WP_Post $post Template post.
[788] Fix | Delete
* @param array $terms Additional terms to inform the template object.
[789] Fix | Delete
* @param array $meta Additional meta fields to inform the template object.
[790] Fix | Delete
* @return WP_Block_Template|WP_Error Template or error object.
[791] Fix | Delete
*/
[792] Fix | Delete
function _build_block_template_object_from_post_object( $post, $terms = array(), $meta = array() ) {
[793] Fix | Delete
if ( empty( $terms['wp_theme'] ) ) {
[794] Fix | Delete
return new WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.' ) );
[795] Fix | Delete
}
[796] Fix | Delete
$theme = $terms['wp_theme'];
[797] Fix | Delete
[798] Fix | Delete
$default_template_types = get_default_block_template_types();
[799] Fix | Delete
[800] Fix | Delete
$template_file = _get_block_template_file( $post->post_type, $post->post_name );
[801] Fix | Delete
$has_theme_file = get_stylesheet() === $theme && null !== $template_file;
[802] Fix | Delete
[803] Fix | Delete
$template = new WP_Block_Template();
[804] Fix | Delete
$template->wp_id = $post->ID;
[805] Fix | Delete
$template->id = $theme . '//' . $post->post_name;
[806] Fix | Delete
$template->theme = $theme;
[807] Fix | Delete
$template->content = $post->post_content;
[808] Fix | Delete
$template->slug = $post->post_name;
[809] Fix | Delete
$template->source = 'custom';
[810] Fix | Delete
$template->origin = ! empty( $meta['origin'] ) ? $meta['origin'] : null;
[811] Fix | Delete
$template->type = $post->post_type;
[812] Fix | Delete
$template->description = $post->post_excerpt;
[813] Fix | Delete
$template->title = $post->post_title;
[814] Fix | Delete
$template->status = $post->post_status;
[815] Fix | Delete
$template->has_theme_file = $has_theme_file;
[816] Fix | Delete
$template->is_custom = empty( $meta['is_wp_suggestion'] );
[817] Fix | Delete
$template->author = $post->post_author;
[818] Fix | Delete
$template->modified = $post->post_modified;
[819] Fix | Delete
[820] Fix | Delete
if ( 'wp_template' === $post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) {
[821] Fix | Delete
$template->post_types = $template_file['postTypes'];
[822] Fix | Delete
}
[823] Fix | Delete
[824] Fix | Delete
if ( 'wp_template' === $post->post_type && isset( $default_template_types[ $template->slug ] ) ) {
[825] Fix | Delete
$template->is_custom = false;
[826] Fix | Delete
}
[827] Fix | Delete
[828] Fix | Delete
if ( 'wp_template_part' === $post->post_type && isset( $terms['wp_template_part_area'] ) ) {
[829] Fix | Delete
$template->area = $terms['wp_template_part_area'];
[830] Fix | Delete
}
[831] Fix | Delete
[832] Fix | Delete
return $template;
[833] Fix | Delete
}
[834] Fix | Delete
[835] Fix | Delete
/**
[836] Fix | Delete
* Builds a unified template object based a post Object.
[837] Fix | Delete
*
[838] Fix | Delete
* @since 5.9.0
[839] Fix | Delete
* @since 6.3.0 Added `modified` property to template objects.
[840] Fix | Delete
* @since 6.4.0 Added support for a revision post to be passed to this function.
[841] Fix | Delete
* @access private
[842] Fix | Delete
*
[843] Fix | Delete
* @param WP_Post $post Template post.
[844] Fix | Delete
* @return WP_Block_Template|WP_Error Template or error object.
[845] Fix | Delete
*/
[846] Fix | Delete
function _build_block_template_result_from_post( $post ) {
[847] Fix | Delete
$post_id = wp_is_post_revision( $post );
[848] Fix | Delete
if ( ! $post_id ) {
[849] Fix | Delete
$post_id = $post;
[850] Fix | Delete
}
[851] Fix | Delete
$parent_post = get_post( $post_id );
[852] Fix | Delete
$post->post_name = $parent_post->post_name;
[853] Fix | Delete
$post->post_type = $parent_post->post_type;
[854] Fix | Delete
[855] Fix | Delete
$terms = get_the_terms( $parent_post, 'wp_theme' );
[856] Fix | Delete
[857] Fix | Delete
if ( is_wp_error( $terms ) ) {
[858] Fix | Delete
return $terms;
[859] Fix | Delete
}
[860] Fix | Delete
[861] Fix | Delete
if ( ! $terms ) {
[862] Fix | Delete
return new WP_Error( 'template_missing_theme', __( 'No theme is defined for this template.' ) );
[863] Fix | Delete
}
[864] Fix | Delete
[865] Fix | Delete
$terms = array(
[866] Fix | Delete
'wp_theme' => $terms[0]->name,
[867] Fix | Delete
);
[868] Fix | Delete
[869] Fix | Delete
if ( 'wp_template_part' === $parent_post->post_type ) {
[870] Fix | Delete
$type_terms = get_the_terms( $parent_post, 'wp_template_part_area' );
[871] Fix | Delete
if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) {
[872] Fix | Delete
$terms['wp_template_part_area'] = $type_terms[0]->name;
[873] Fix | Delete
}
[874] Fix | Delete
}
[875] Fix | Delete
[876] Fix | Delete
$meta = array(
[877] Fix | Delete
'origin' => get_post_meta( $parent_post->ID, 'origin', true ),
[878] Fix | Delete
'is_wp_suggestion' => get_post_meta( $parent_post->ID, 'is_wp_suggestion', true ),
[879] Fix | Delete
);
[880] Fix | Delete
[881] Fix | Delete
$template = _build_block_template_object_from_post_object( $post, $terms, $meta );
[882] Fix | Delete
[883] Fix | Delete
if ( is_wp_error( $template ) ) {
[884] Fix | Delete
return $template;
[885] Fix | Delete
}
[886] Fix | Delete
[887] Fix | Delete
// Check for a block template without a description and title or with a title equal to the slug.
[888] Fix | Delete
if ( 'wp_template' === $parent_post->post_type && empty( $template->description ) && ( empty( $template->title ) || $template->title === $template->slug ) ) {
[889] Fix | Delete
$matches = array();
[890] Fix | Delete
[891] Fix | Delete
// Check for a block template for a single author, page, post, tag, category, custom post type, or custom taxonomy.
[892] Fix | Delete
if ( preg_match( '/(author|page|single|tag|category|taxonomy)-(.+)/', $template->slug, $matches ) ) {
[893] Fix | Delete
$type = $matches[1];
[894] Fix | Delete
$slug_remaining = $matches[2];
[895] Fix | Delete
[896] Fix | Delete
switch ( $type ) {
[897] Fix | Delete
case 'author':
[898] Fix | Delete
$nice_name = $slug_remaining;
[899] Fix | Delete
$users = get_users(
[900] Fix | Delete
array(
[901] Fix | Delete
'capability' => 'edit_posts',
[902] Fix | Delete
'search' => $nice_name,
[903] Fix | Delete
'search_columns' => array( 'user_nicename' ),
[904] Fix | Delete
'fields' => 'display_name',
[905] Fix | Delete
)
[906] Fix | Delete
);
[907] Fix | Delete
[908] Fix | Delete
if ( empty( $users ) ) {
[909] Fix | Delete
$template->title = sprintf(
[910] Fix | Delete
/* translators: Custom template title in the Site Editor, referencing a deleted author. %s: Author nicename. */
[911] Fix | Delete
__( 'Deleted author: %s' ),
[912] Fix | Delete
$nice_name
[913] Fix | Delete
);
[914] Fix | Delete
} else {
[915] Fix | Delete
$author_name = $users[0];
[916] Fix | Delete
[917] Fix | Delete
$template->title = sprintf(
[918] Fix | Delete
/* translators: Custom template title in the Site Editor. %s: Author name. */
[919] Fix | Delete
__( 'Author: %s' ),
[920] Fix | Delete
$author_name
[921] Fix | Delete
);
[922] Fix | Delete
[923] Fix | Delete
$template->description = sprintf(
[924] Fix | Delete
/* translators: Custom template description in the Site Editor. %s: Author name. */
[925] Fix | Delete
__( 'Template for %s' ),
[926] Fix | Delete
$author_name
[927] Fix | Delete
);
[928] Fix | Delete
[929] Fix | Delete
$users_with_same_name = get_users(
[930] Fix | Delete
array(
[931] Fix | Delete
'capability' => 'edit_posts',
[932] Fix | Delete
'search' => $author_name,
[933] Fix | Delete
'search_columns' => array( 'display_name' ),
[934] Fix | Delete
'fields' => 'display_name',
[935] Fix | Delete
)
[936] Fix | Delete
);
[937] Fix | Delete
[938] Fix | Delete
if ( count( $users_with_same_name ) > 1 ) {
[939] Fix | Delete
$template->title = sprintf(
[940] Fix | Delete
/* translators: Custom template title in the Site Editor. 1: Template title of an author template, 2: Author nicename. */
[941] Fix | Delete
__( '%1$s (%2$s)' ),
[942] Fix | Delete
$template->title,
[943] Fix | Delete
$nice_name
[944] Fix | Delete
);
[945] Fix | Delete
}
[946] Fix | Delete
}
[947] Fix | Delete
break;
[948] Fix | Delete
case 'page':
[949] Fix | Delete
_wp_build_title_and_description_for_single_post_type_block_template( 'page', $slug_remaining, $template );
[950] Fix | Delete
break;
[951] Fix | Delete
case 'single':
[952] Fix | Delete
$post_types = get_post_types();
[953] Fix | Delete
[954] Fix | Delete
foreach ( $post_types as $post_type ) {
[955] Fix | Delete
$post_type_length = strlen( $post_type ) + 1;
[956] Fix | Delete
[957] Fix | Delete
// If $slug_remaining starts with $post_type followed by a hyphen.
[958] Fix | Delete
if ( 0 === strncmp( $slug_remaining, $post_type . '-', $post_type_length ) ) {
[959] Fix | Delete
$slug = substr( $slug_remaining, $post_type_length, strlen( $slug_remaining ) );
[960] Fix | Delete
$found = _wp_build_title_and_description_for_single_post_type_block_template( $post_type, $slug, $template );
[961] Fix | Delete
[962] Fix | Delete
if ( $found ) {
[963] Fix | Delete
break;
[964] Fix | Delete
}
[965] Fix | Delete
}
[966] Fix | Delete
}
[967] Fix | Delete
break;
[968] Fix | Delete
case 'tag':
[969] Fix | Delete
_wp_build_title_and_description_for_taxonomy_block_template( 'post_tag', $slug_remaining, $template );
[970] Fix | Delete
break;
[971] Fix | Delete
case 'category':
[972] Fix | Delete
_wp_build_title_and_description_for_taxonomy_block_template( 'category', $slug_remaining, $template );
[973] Fix | Delete
break;
[974] Fix | Delete
case 'taxonomy':
[975] Fix | Delete
$taxonomies = get_taxonomies();
[976] Fix | Delete
[977] Fix | Delete
foreach ( $taxonomies as $taxonomy ) {
[978] Fix | Delete
$taxonomy_length = strlen( $taxonomy ) + 1;
[979] Fix | Delete
[980] Fix | Delete
// If $slug_remaining starts with $taxonomy followed by a hyphen.
[981] Fix | Delete
if ( 0 === strncmp( $slug_remaining, $taxonomy . '-', $taxonomy_length ) ) {
[982] Fix | Delete
$slug = substr( $slug_remaining, $taxonomy_length, strlen( $slug_remaining ) );
[983] Fix | Delete
$found = _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy, $slug, $template );
[984] Fix | Delete
[985] Fix | Delete
if ( $found ) {
[986] Fix | Delete
break;
[987] Fix | Delete
}
[988] Fix | Delete
}
[989] Fix | Delete
}
[990] Fix | Delete
break;
[991] Fix | Delete
}
[992] Fix | Delete
}
[993] Fix | Delete
}
[994] Fix | Delete
[995] Fix | Delete
$hooked_blocks = get_hooked_blocks();
[996] Fix | Delete
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
[997] Fix | Delete
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
[998] Fix | Delete
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $template, 'insert_hooked_blocks_and_set_ignored_hooked_blocks_metadata' );
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function