function cptui_register_my_cpts_homepage_brands() {
/**
* Post Type: Homepage Brands.
*/
$labels = array(
'name' => _x( 'Homepage Brands', 'astra' ),
'singular_name' => _x( 'Homepage Brands', 'astra' ),
'menu_name' => _x( 'Homepage Brands', 'astra' ),
'name_admin_bar' => _x( 'Homepage Brands', 'astra' ),
'add_new' => __( 'Add New Brands', 'astra' ),
'add_new_item' => __( 'Add New Brands', 'astra' ),
'new_item' => __( 'New Brands', 'astra' ),
'edit_item' => __( 'Edit Brands', 'astra' ),
'view_item' => __( 'View Brands', 'astra' ),
'all_items' => __( 'All Brands', 'astra' ),
'search_items' => __( 'Search Brands', 'astra' ),
'parent_item_colon' => __( 'Parent Brands:', 'astra' ),
'not_found' => __( 'No Brands found.', 'astra' ),
'not_found_in_trash' => __( 'No Brands found in Trash.', 'astra' ),
'featured_image' => _x( 'Brands Image', 'astra' ),
'set_featured_image' => _x( 'Set Brands image', 'astra' ),
'remove_featured_image' => _x( 'Remove Brands image', 'astra' ),
'use_featured_image' => _x( 'Use as Brands image', 'astra' ),
'archives' => _x( 'Project archives', 'astra' ),
'insert_into_item' => _x( 'Insert into Brands', 'astra' ),
'uploaded_to_this_item' => _x( 'Uploaded to this Brands', 'astra' ),
'filter_items_list' => _x( 'Filter Brands list', 'astra' ),
'items_list_navigation' => _x( 'Brands list navigation', 'astra' ),
'items_list' => _x( 'Brands list', 'astra' ),
);
$args = array(
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"delete_with_user" => false,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => false,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => array( "slug" => "homepage_brands", "with_front" => true ),
"query_var" => true,
"supports" => array( "title", "editor", "thumbnail" ),
);
register_post_type( "homepage_brands", $args );
}
add_action( 'init', 'cptui_register_my_cpts_homepage_brands' );
<div class="your-class">
<?php
$args = array(
'post_type' => 'homepage_brands',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
);
$brand = new WP_Query($args);
if ( $brand->have_posts() ) {
while ( $brand->have_posts() ) {
$brand->the_post();
$thumbnail = get_the_post_thumbnail_url(get_the_ID(), 'full');
if (!$thumbnail)
continue;
?>
<div><img src="<?php echo $thumbnail; ?>"></div>
<?php
}
}
wp_reset_postdata();
?>
</div>