Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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' );
}
Source by wordpress.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #pass #id #template #part
ADD COMMENT
Topic
Name
9+1 =