Answers for "how to pass id through get template part"

PHP
1

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' );
}
Posted by: Guest on April-15-2020

Code answers related to "how to pass id through get template part"

Browse Popular Code Answers by Language