Skip to content

Commit

Permalink
Update search result listing
Browse files Browse the repository at this point in the history
  • Loading branch information
wilson1000 committed Oct 31, 2024
1 parent 49f2d61 commit f530ad2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions public/app/themes/clarity/inc/content-filter/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

class Search
{

/**
* FilterSearch constructor.
*
Expand Down Expand Up @@ -51,7 +50,7 @@ public function hooks(): void
* @return void
*/

public function loadEventSearchResults()
public function loadEventSearchResults(): void
{
if (!wp_verify_nonce($_POST['_nonce'], 'search_filter_nonce')) {
exit('Access not allowed.');
Expand All @@ -76,7 +75,7 @@ public function loadEventSearchResults()

$events = $events_helper->get_events($agency_term_id, $filter_options) ?? [];

return wp_send_json([
wp_send_json([
'aggregates' => [
'totalResults' => count($events),
'resultsPerPage' => -1,
Expand All @@ -85,7 +84,7 @@ public function loadEventSearchResults()
'results' => [
'templateName' => "c-events-item-list",
'posts' => array_map([$this, 'mapEventResult'], $events),
],
]
]);
}

Expand Down Expand Up @@ -143,12 +142,13 @@ public function mapPostResult(\WP_Post $post)
$thumbnail = get_the_post_thumbnail_url($post->ID, 'user-thumb');
$thumbnail_alt = get_post_meta(get_post_thumbnail_id($post->ID), '_wp_attachment_image_alt', true);

$author = $post->post_author;
$author_display_name = $author ? get_the_author_meta('display_name', $author) : '';
$authors = new Authors();
$authors = $authors->getAuthorInfo($post->ID);
$author = $authors[0] ?? false;
$author_display_name = $author['name'] ?? false;

if (!$thumbnail) {
// Mutate thumbnail with author image.
$thumbnail = $author ? get_the_author_meta('thumbnail_avatar', $author) : false;
$thumbnail = $author['thumbnail_url'] ?? false;
$thumbnail_alt = $author_display_name;
}

Expand All @@ -161,7 +161,7 @@ public function mapPostResult(\WP_Post $post)
'permalink' => get_permalink($post->ID),
'post_thumbnail' => $thumbnail,
'post_thumbnail_alt' => $thumbnail_alt,
'author_display_name' => $author ? get_the_author_meta('display_name', $author) : '',
'author_display_name' => $author_display_name,
];
}

Expand Down

0 comments on commit f530ad2

Please sign in to comment.