Feature image Gallery made from Custom Post type + Categories

Given that there is a custom post type in the code. And what you may want to do includes a few steps and tests. The following may help in kicking start and continue to explore.
The best things to do is always testing in a fundamental environment without plugins and theme interference by using the default theme and turn off unnecessary plugins. This could also save a lot of time.

  • Use a query to create a loop and get the custom posts (put in argument to query with custom post type and custom taxonomy…etc)
  • fetch the image from the post during the loop using such as get_the_post_thumbnail()
  • after fetching and output the gallery image and style it with css, may add custom style/script in theme functions.php with hook wp_enqueue_scripts and function wp_enqueue_script()
  • for the above is satifised, may also consider pagination
  • After successfully doing a traditional page loading version with pagination. The concept for using ajax is similar, could refer to Handbook about Ajax, but just need to use WP way to accomplish it. May also refer to practical example in this post too.

The following could be put in any template other than homepage. For page being set to frontpage, the behaviour of the loop variable is a little bit different.

<?php
// a simple query to a custom post could help to start
// create a query in the template

// could explore more about the arguments through the above links
$args = array(
    'post_type'         => 'brand',
);

$query = new WP_Query($args);

while ($query->have_posts()) {
    $query->the_post();

    // output the image here
}
wp_reset_postdata();
?>