I want to use the following code multiple times in the same page template, however the template gets too big when it comes to lines of code and therefore size. Every time I use it I change only one parameter and 99% remains the same. The parameter I change is
'terms'=>'pop'. I know I can display all posts and all taxonomy terms (taxonomies posts under each taxonomy) with a relatively small piece of code but that will not work as I want since I want to order taxonomies in a custom way, not by title or term (ASC/DSC). What I am thinking is maybe add the code to a fuction and each time I call the function I just pass the parameter which changes.
$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' => 'pop' // THIS IS WHAT CHANGES ) ) ) );