get custom post with taxonomy

<?php
//for a given post type, return all
$post_type = 'menu';
$tax = 'menu_category';
$tax_terms = get_terms($tax);
//echo "

";print_r( $tax_terms);echo "

“;
$term_id=$tax_terms[0]->term_id;
$term_slug=$tax_terms[0]->slug;
if ($term_id) {
foreach ($tax_terms as $tax_term) {
$myposts = get_posts(array(
‘showposts’ => -1,
‘post_type’ => ‘menu’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘menu_category’,
‘field’ => ‘slug’,
‘terms’ => array($tax_term->slug)),
))
);
?>

name; ?>

  • post_title;?>

    ID, ‘price’, true); ?>

    post_content; ?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s