Skip to content

Instantly share code, notes, and snippets.

@sunilw
Created November 16, 2021 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunilw/114d4dcb66d7e1a817e6800ba3e09331 to your computer and use it in GitHub Desktop.
Save sunilw/114d4dcb66d7e1a817e6800ba3e09331 to your computer and use it in GitHub Desktop.
/* the function that loads the template with the loop */
function ginza_menu_display() {
if ( class_exists('ACF')) {
ob_start() ;
require get_stylesheet_directory() . '/loops/ginza-menu-display.php' ;
echo ob_get_clean() ;
}
}
/** the loop **/
<?php
/**
* Presentation of Ginza Menus
*/
$args = array(
'posts_per_page' => 2,
'post_type' => 'ginza_menu'
) ;
$my_query = new WP_Query($args) ;
?>
<?php if ($my_query->have_posts()) : ?>
<section id="ginza-menus">
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<article class="ginza-menu" >
<div class="thumb-container">
<?php echo get_the_post_thumbnail() ?>
</div>
<div class="course-details">
<header>
<h4 class="menu-title"><?php the_title() ?></h4>
</header>
<div class="details-inner">
<div class="courses">
<div class="entrees">
<h4 class="ginza-submenu-header">Entrees</h4>
<ul>
<?php while(have_rows('entree')) : the_row(); ?>
<?php $item = get_sub_field('item'); ?>
<li><?php echo $item ?></li>
<?php endwhile ?>
</ul>
</div>
<div class="mains">
<ul>
<h4>Mains</h4>
<?php while(have_rows('mains')) : the_row(); ?>
<?php $item = get_sub_field('item'); ?>
<li><?php echo $item ?></li>
<?php endwhile ?>
</ul>
</div>
</div> <!-- ENDS .courses -->
<div class="price">
<?php $price = get_field('price') ?>
<p><?php echo $price ?></p>
</div>
</div> <!-- ENDS .details-inner -->
</div> <!-- ENDS .course-details -->
</article> <!-- ends .ginza-menu -->
<?php endwhile; ?>
</section> <!-- ENDS #ginza-menuis-container -->
<?php endif; ?>
<?php wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment