Possible Duplicate:
Wordpress - Programmatically change post templates?
I need to change the template on several hundred pages on my site. Does anyone know if there is a command to do it programmatically? See the following code snippet; I'd like to replace my comment inside the loop with a function that will change the template of the current page:
query = new WP_Query($args);
while ( $query->have_posts() ) : $the_query->the_post();
if ( has_tag('tag-slug') )
{
/* CHANGE TEMPLATE OF $post */
}
endwhile;
wp_reset_postdata();