MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/webofai.imenso.co/wp-content/themes/webofai_theme-old/archive.php
<?php
get_header();
// get categories
$cat_args   = array(
  'taxonomy' => 'category',
  'orderby'  => 'name',
  'order'    => 'ASC',
);
$categories = get_categories( $cat_args );
?>
  <section class="wp_collection_block"
           data-section-class="wp_collection_block">
    <div class="container">
      <h2 class="wp-collection-title headline-1"><?= get_the_archive_title(); ?></h2>
      <?php if ( get_the_archive_description() ) { ?>
        <div class="wp-collection-description paragraph"><?= get_the_archive_description() ?></div>
      <?php } ?>
      <?php foreach ( $categories as $category ) {
        $args  = array(
          'showposts'           => 5,
          'category__in'        => array( $category->term_id ),
          'orderby'             => 'date',
          'order'               => 'DESC',
          'ignore_sticky_posts' => 1
        );
        $posts = get_posts( $args );
        if ( $posts ) {
          foreach ( $posts as $post ) {
            $post_id = $post->ID;
            get_template_part( "partials/collection-card", '', array( 'post_id' => $post_id ) );
          }
        }
      } ?>
    </div>
  </section>
<?php get_footer();