Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Food Menus
- */
- get_header(); ?>
- <?php get_sidebar('menu'); ?>
- <?php
- $food_args = array( 'post_type' => 'food_menu_items', 'numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC');
- $food_items = get_posts($food_args);
- $food_content = array();
- foreach($food_items as $food) {
- $name = get_field("name",$food->ID);
- $description = get_field("description",$food->ID);
- $price = get_field("price",$food->ID);
- $category = get_field("menu_category",$food->ID);
- }
- ?>
- <?php
- $args = array(
- 'post_type' => 'food_menu_items',
- 'meta_key' => 'menu_category',
- 'meta_value' => get_the_title(),
- );
- $query = new WP_Query($args); ?>
- <?php if ( $query->have_posts() ) while ( $query->have_posts() ) : $query->the_post(); ?>
- <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <div class="entry-content">
- <h2><?php the_title(); ?></h2>
- <?php the_content(); ?>
- <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'boilerplate' ), 'after' => '' ) ); ?>
- <?php edit_post_link( __( 'Edit', 'boilerplate' ), '', '' ); ?>
- </div><!-- .entry-content -->
- </article><!-- #post-## -->
- <div class="menu-entry">
- <p class="menu-title"><?php echo $name; ?></p>
- <p class="menu-description"><?php echo $description; ?> <span class="menu-price"><?php echo $price; ?>—</span></p>
- </div>
- <?php endwhile; ?>
- <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment