Skip to content

Commit

Permalink
fix: remove 'Not Found' from translated template titles
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquimds committed Nov 13, 2023
1 parent 1a072e8 commit 1d7975c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions web/app/themes/awasqa/src/wpml.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,15 @@ function connect_translations_page()
add_action('user_register', function ($user_id, $userdata) {
update_user_meta($user_id, \WPML_User_Jobs_Notification_Settings::BLOCK_NEW_NOTIFICATION_FIELD, 1);
}, 10, 2);

add_filter('get_block_templates', function ($query_result, $query, $template_type) {
if ($template_type !== "wp_template") {
return;
}
$not_found_text = __('Not found: %1$s (%2$s)');
$not_found_part = explode(":", $not_found_text)[0] . ": ";
foreach ($query_result as $result) {
$result->title = str_replace($not_found_part, "", $result->title);
}
return $query_result;
}, 10, 3);

0 comments on commit 1d7975c

Please sign in to comment.