Skip to content

Commit

Permalink
Fix by-author on frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
elzadj committed Jun 19, 2024
1 parent d58632e commit abb221f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/class-maxi-dynamic-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public function get_total_posts_by_relation($relation, $id, $type = 'post')
}
}


// Create a new WP_Query instance
$query = new WP_Query($args);

Expand Down Expand Up @@ -1120,7 +1121,7 @@ public function get_post($attributes)

$query = new WP_Query($args);

if (empty($query->posts) && !$is_current_archive) {
if (empty($query->posts) && !$is_current_archive && $dc_relation !== 'by-author') {
$validated_attributes = self::get_validated_orderby_attributes($dc_relation, $dc_id);
if (in_array($dc_relation, self::$order_by_relations) && $validated_attributes) {
return $this->get_post(array_replace($attributes, $validated_attributes));
Expand Down Expand Up @@ -2119,6 +2120,7 @@ public function get_order_by_args($relation, $order_by, $order, $accumulator, $t
}
} elseif($relation === 'by-author') {
$args['author'] = $id;

} elseif($relation === 'by-tag') {
if ($type === 'products') {
$args['tag'] = [$this->get_term_slug($id)];
Expand Down

0 comments on commit abb221f

Please sign in to comment.