
  <?php
  echo apply_filters("inoby_post_list_before", "<div class=\"row\">");

  $category = get_category(get_query_var("cat"));
  $cat_id = $category->cat_ID ?? null;
  $tag = get_queried_object();
  $tag_id = $tag->term_id ?? null;

  $tax_query = [];
  if ($cat_id) {
    $tax_query[] = [
      "taxonomy" => "category",
      "field" => "term_id", //change to name or slug if necessary
      "terms" => $cat_id,
    ];
  }

  if ($tag_id) {
    $tax_query[] = [
      "taxonomy" => "post_tag",
      "field" => "term_id", //change to name or slug if necessary
      "terms" => $tag_id,
    ];
  }

  if (count($tax_query) > 1) {
    $tax_query["relation"] = "OR";
  }

  $posts_args = [
    "post_type" => "post",
    "posts_per_page" => get_option("posts_per_page"),
    "offset" => Inoby_Config::latest_posts(),
    "orderby" => "date",
    "order" => "desc",
    "tax_query" => $tax_query,
  ];
  $posts_query = new WP_Query($posts_args);
  if ($posts_query->have_posts()):
    $posts_query_index = 0;
    while ($posts_query->have_posts()):
      $posts_query->the_post();
      echo apply_filters("inoby_post_list_card_before", "<div class=\"col-3 col-md-6 col-sm-12\">");
      get_template_part("post-types/post/parts/card", null, ["post" => $post]);
      echo apply_filters("inoby_post_list_card_after", "</div>");
      do_action("posts_query_loop", $posts_query_index);
      $posts_query_index++;
    endwhile;
  endif;
  ?>
  <div id="load-more-posts"></div>
  <?php echo apply_filters("inoby_post_list_after", "</div>");
