To expand on the answer by Global:
Paste this into your theme’s functions.php:
function get_stations_query( $terms ) {
//create new query object
$query = new WP_Query( array(
'post_type' => 'stations',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'genres',
'field' => 'name',
'terms' => $terms
)
)
) );
return $query; //return the object
}
Then in your template files you can use:
$query = get_stations_query('pop');