function show_menu($post) { $menuService = new MenuService(); $menus = $menuService->getMenuByRestaurantId($post->ID); ?> <h2>Platos en <?php echo $post->post_title; ?> </h2> <?php if (count($menus) > 0) { ?> <div class="row"> <div class="col-md-12"> <table class="table"> <thead> <tr> <th>Nombre</th> <th>Tipo</th> <th >Ingredientes</th> <th >Precio</th> <th></th> </tr> </thead> <tbody> <?php foreach ($menus as $menu) { $menuType = $menu->menuType; $topics = ""; foreach ($menu->topics as $topic) { if (strlen($topics) > 0) { $topics .= ", "; } $topics .= $topic->name; } ?> <tr> <td><?php echo $menu->name; ?> </td> <td><?php echo $menuType->name; ?> <img alt="Plato <?php echo $menuType->name; ?> " title="Plato <?php echo $menuType->name; ?> " src="<?php echo MECATO_PLUGIN_URL . 'inc/img/menuIcons/' . $menuType->slug . '.png'; ?> " width="20" height="20"/></td> <td><?php echo $topics; ?> </td> <td><?php echo $menu->price; ?> </td> <td><a href="<?php echo $menu->guid; ?> " class="btn btn-xs btn-primary">Ver</a></td> </tr> <?php } ?> </tbody> </table> </div> </div> <?php } else { ?> <div class="alert alert-danger" role="alert"> <strong>Oops!</strong> No tenemos platos registrados para este restaurante. Si conoces alguno ayudanos acá. <a href="<?php echo get_permalink(MECATO_PLUGIN_PAGE_CREATE_MENU) . "?restId=" . $post->ID; ?> " class="btn btn-xs btn-danger">Crear plato</a> </div> <?php } }