-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebrunch.php
66 lines (59 loc) · 1.69 KB
/
webrunch.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* Menu : weekend_brunch
*/
?>
<div id="content" class="menus-content" role="main">
<!-- start weekday brunch query -->
<?php
//get all categories then display all posts in each term
$taxonomy = 'category';// e.g. post_tag, category
$param_type = 'category__in'; // e.g. tag__in, category__in
$term_args=array(
'name' => 'Weekend Brunch'
);
$terms = get_terms($taxonomy,$term_args);
if ($terms) {
foreach($terms as $term){ //this foreach is for top level
if($terms){
$term_args=array(
'orderby' => 'name',
'order' => 'ASC',
);
$termss = get_terms($taxonomy,$term_args);
foreach( $termss as $terms ) { //this foreach is for second level
$args=array(
"$param_type" => array($terms->term_id),
'post_type' => 'webrunchitems',
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) { ?>
<div class="category section">
<h3><?php echo ''.$terms->name; //get second level category name?></h3>
<h4><?php echo ''.$terms->description; //get second level category description?></h4>
<ul class="menus">
<?php
while ($my_query->have_posts()) : $my_query->the_post();
echo "<li><div id='kmenuitem'>" ;
the_title('<h3>','</h3>');
echo "<span class='kitchen-entry'>" ;
the_content();
echo get_the_term_list($post->ID, 'price', '...', ', ', '');
echo "</span></li>" ;
endwhile;
?>
</ul>
</div>
<?php
}}
}
}
}
wp_reset_query(); // Restore global post data stomped by the_post().
?>
<!-- end weekday brunch query query -->
<!-- #content .site-content -->