how to pass id through get template part code example
Example: how to pass id through get template part
<?php
get_header();
// etc.
// In the main template file
$users = new \WP_User_Query( [ ... ] );
foreach ( $users as $user )
{
set_query_var( 'user_id', absint( $user->ID ) );
get_template_part( 'template-parts/user', 'contact_methods' );
}