* @version 2.3.0 */ if (!defined('ABSPATH')) { exit; } //wc_print_notices(); ?> <div class="[ container ]"> <div class="[ row ]"> <section class="[ col-xs-12 col-md-7 ]"> <article class="[ ]"> <?php if (is_lunch() && can_order_lunch()) { get_template_part('templates/menu', 'complementos'); } ?> <?php get_template_part('templates/menu', 'aguas'); ?> <?php get_template_part('templates/menu', 'postre'); ?> </article> <?php do_action('woocommerce_before_checkout_form', $checkout); // If checkout registration is disabled and not logged in, the user cannot checkout if (!$checkout->enable_signup && !$checkout->enable_guest_checkout && !is_user_logged_in()) {
public function today_menu() { $data = array('can_order_today' => can_order_today(), 'menu' => array(), 'aguas' => array(), 'postres' => array(), 'sides' => array()); error_log(can_order_today()); $dia = date('Y-m-d'); if (!can_order_today()) { DABBA_API_Output::get()->output(true, 200, '', $data); } $product_args = array('post_type' => 'product', 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_fecha_menu_meta', 'value' => $dia))); if (can_order_breakfast() && has_breakfast()) { $product_args['tax_query'] = array(array('taxonomy' => 'comida-del-dia', 'field' => 'slug', 'terms' => 'desayuno')); } else { if (can_order_lunch() && has_lunch()) { $product_args['tax_query'] = array(array('taxonomy' => 'comida-del-dia', 'field' => 'slug', 'terms' => 'comida')); } else { if (can_order_dinner() && has_dinner()) { $product_args['tax_query'] = array(array('taxonomy' => 'comida-del-dia', 'field' => 'slug', 'terms' => 'cena')); } } } $query = new WP_Query($product_args); while ($query->have_posts()) { if ($query->have_posts()) { $query->the_post(); global $product; global $post; $image_ids = $product->get_gallery_attachment_ids(); $image = wp_get_attachment_url($image_ids[0]); $horizontal_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); if (!$image) { $image = $horizontal_image; } $carTemp = get_the_terms($post->ID, 'caracteristica-platillo'); $caracteristicas_platillo = array(); if (!empty($carTemp)) { foreach ($carTemp as $caracteristica) { $caracteristicas_platillo[] = array('icon' => THEMEPATH . "icons/" . $caracteristica->slug . ".svg", 'name' => $caracteristica->name); } } $ingredientes = get_ingredientes($post->ID); $guarnicion_1 = get_post_meta($post->ID, '_guarnicion_1_meta', true); $guarnicion_2 = get_post_meta($post->ID, '_guarnicion_2_meta', true); $porcion = get_post_meta($post->ID, '_porcion_meta', true); $proteina = get_post_meta($post->ID, '_proteina_meta', true); $calorias = get_post_meta($post->ID, '_calorias_meta', true); $fibra_dietetica = get_post_meta($post->ID, '_fibra_dietetica_meta', true); $menu = array('id' => get_the_ID(), 'title' => html_entity_decode(get_the_title()), 'descripcion' => format_contenido_platillo($guarnicion_1, $guarnicion_2), 'content' => get_the_content(), 'image' => $image, 'horizontal_image' => $horizontal_image[0], 'guarnicion_1' => $guarnicion_1, 'guarnicion_2' => $guarnicion_2, 'caracteristicas_platillo' => $caracteristicas_platillo, 'ingredientes' => $ingredientes, 'porcion' => $porcion, 'proteina' => $proteina, 'calorias' => $calorias, 'fibra_dietetica' => $fibra_dietetica, 'price' => $product->get_price(), 'stock' => $product->get_stock_quantity(), 'is_in_stock' => $product->is_in_stock(), 'menu_date' => $dia); $data['menu'][] = $menu; } } $data['aguas'] = $this->get_additional_items('agua', 4); $data['postres'] = $this->get_additional_items('postre', 4); $data['sides'] = $this->get_additional_items('complemento', 4); DABBA_API_Output::get()->output(true, 200, '', $data); }
<?php if (can_order_breakfast() || can_order_tomorrows_breakfast()) { get_template_part('templates/menu', 'desayuno'); } ?> <?php if (can_order_lunch()) { get_template_part('templates/menu', 'comida'); } ?> <?php // if( can_order_dinner() ) get_template_part( 'templates/menu', 'cena' ); ?> <?php if (!can_order_breakfast() and !can_order_lunch() and !can_order_tomorrows_breakfast()) { get_template_part('templates/menu', 'empty'); } ?> <?php //if ( is_user_logged_in() ) get_template_part( 'templates/store_credits' ); ?> <section class="[ detalles ][ margin-bottom--large ]"> <div class="[ container ][ text-center color-secondary ]"> <div class="[ block ][ col-xs-12 col-sm-10 col-md-8 col-lg-6 col-centered ][ text-center ]"> <h2 class="">Detalles</h2> <div class="[ row ]"> <div class="[ col-xs-12 col-sm-6 ][ margin-bottom ]"> <img class="[ svg ][ icon icon--feature icon--stroke ][ margin-bottom--small ]" src="<?php
/** * Regresa las ventanas de tiempo disponibles para el platillo del día / semana * @return array $timeframe_options */ function get_valid_timeframe($type = "json") { if (is_breakfast() && can_order_breakfast()) { return get_valid_breakfast_timeframe($type); } if (!can_order_breakfast() && can_order_lunch()) { return get_valid_lunch_timeframe($type); } if (can_order_tomorrows_breakfast()) { return get_valid_breakfast_timeframe($type); } //if( is_dinner() ) return get_valid_dinner_timeframe( $type ); return 0; }