This commit is contained in:
2026-05-06 11:49:49 -04:00
parent 9d61851a75
commit 7cb5c30b71
11 changed files with 58 additions and 32 deletions

View File

@@ -11,8 +11,12 @@ function cascapedia_st_jules_locale(): string {
return str_starts_with( $path, '/en' ) ? 'en' : 'fr';
}
function cascapedia_st_jules_clean_text( ?string $value ): string {
return html_entity_decode( (string) $value, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
}
function cascapedia_st_jules_l( ?string $value ): array {
$value = (string) $value;
$value = cascapedia_st_jules_clean_text( $value );
return [ 'fr' => $value, 'en' => $value ];
}
@@ -117,7 +121,7 @@ function cascapedia_st_jules_get_businesses(): array {
]);
$businesses = array_map( static function ( WP_Post $post ): array {
return [
'name' => get_the_title( $post ),
'name' => cascapedia_st_jules_clean_text( get_the_title( $post ) ),
'description' => cascapedia_st_jules_l( wp_strip_all_tags( $post->post_content ) ),
'phone' => (string) get_post_meta( $post->ID, 'phone', true ),
'email' => (string) get_post_meta( $post->ID, 'email', true ),