Guest User

Untitled

a guest
Jul 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Food Menus
  4. */
  5.  
  6. get_header(); ?>
  7.  
  8. <?php get_sidebar('menu'); ?>
  9.  
  10. <?php
  11. $food_args = array( 'post_type' => 'food_menu_items', 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC');
  12. $food_items = get_posts($food_args);
  13. $food_content = array();
  14. foreach($food_items as $food) {
  15.  
  16.  
  17. $name = get_field("name",$food->ID);
  18. $description = get_field("description",$food->ID);
  19. $price = get_field("price",$food->ID);
  20. $category = get_field("menu_category",$food->ID);
  21.  
  22. }
  23. ?>
  24.  
  25. <?php
  26. $args = array(
  27. 'post_type' => 'food_menu_items',
  28. 'meta_key' => 'menu_category',
  29. 'meta_value' => get_the_title(),
  30.  
  31. );
  32. $query = new WP_Query($args); ?>
  33.  
  34. <?php if ( $query->have_posts() ) while ( $query->have_posts() ) : $query->the_post(); ?>
  35. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  36. <div class="entry-content">
  37. <h2><?php the_title(); ?></h2>
  38. <?php the_content(); ?>
  39. <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'boilerplate' ), 'after' => '' ) ); ?>
  40. <?php edit_post_link( __( 'Edit', 'boilerplate' ), '', '' ); ?>
  41. </div><!-- .entry-content -->
  42. </article><!-- #post-## -->
  43.  
  44. <div class="menu-entry">
  45. <p class="menu-title"><?php echo $name; ?></p>
  46. <p class="menu-description"><?php echo $description; ?> <span class="menu-price"><?php echo $price; ?>&mdash;</span></p>
  47. </div>
  48. <?php endwhile; ?>
  49.  
  50. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment