Im trying to output category with its post on a single page, but for some reason the post from all category are repeating in each category, what am i doing wrong here Here the code:
<?php
#Template Name: food
get_header();
?>
<?php
$taxonomy = 'category';
$param_type = 'category__in';
$term_args = array(
'orderby' => 'name',
'order' => 'ASC',
'exclude' => 1
);
$terms = get_terms($taxonomy, $term_args);
?>
<div class="row">
<?php if($terms) : ?>
<?php $counter = 0; foreach($terms as $term) : $counter++; ?>
<?php
$args = array(
'$param_type' => array($term->term_id),
'post_type' => 'food',
'post_status' => 'publish',
'posts_per_page' => -1
);
$my_query = null;
$my_query = new Wp_Query($args);
?>
<?php if($my_query->have_posts()) : ?>
<?php if($counter == 2): ?>
<ul class="menu-list sixcol last">
<?php $counter = 0; else: ?>
<ul class="menu-list sixcol">
<?php endif; ?>
<h3><?php echo $term->name; ?></h3>
<?php
while($my_query->have_posts()): $my_query->the_post();
$post_meta_data = get_post_custom($post->ID);
$price = $post_meta_data['fangshsu_price'][0];
?>
<li>
<strong><?php the_title(); ?></strong>
<i><?php if($price) {echo '£' . $price;} ?></i>
<?php the_content();?>
</li>
<?php wp_reset_query(); endwhile; ?>
</ul>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>