How to print term name inside wp post loop
I have 3 different taxonomies in a custom post type. I want to print all posts with term name with them.
for example:
taxonomy 1 =>taxonomy=bankspost_type=creditcards
taxonomy 2 =>taxonomy=joiningfeespost_type=creditcards
taxonomy 3 =>taxonomy=cardtypepost_type=creditcards
So I want to print all the custom posts with the term names I am able to print data by entering single taxonomy but how to print data with all the taxonomy terms
Query
$custom_terms = get_terms('banks');
foreach($custom_terms as $custom_term) {
wp_reset_query();
$args = array('post_type' = 'creditcards',
'tax_query' = array(
array(
'taxonomy' = 'banks',
'field' = 'slug',
'terms' = $custom_term-slug,
),
),
);
$loop = new WP_Query($args);
if($loop-have_posts()) {
while($loop-have_posts()) : $loop-the_post();?
div?php echo $custom_term-name;?br?php echo the_title();?/div
?php endwhile;
}
}
?
End Result that i want in post loop
taxonomy1 term,taxonomy2 term,taxonomy3 term
the title
taxonomy1 term,taxonomy2 term,taxonomy3 term
the title
taxonomy1 term,taxonomy2 term,taxonomy3 term
the title