/** * This functions builds the html for the shortcode. * @param type $atts * @param type $content * @return type */ public function handle_shortcode($atts, $content = null) { global $syn_restaurant_config; $atts = shortcode_atts(array('ids' => '', 'show_image' => 'false', 'image_size' => 'medium'), $atts); extract($atts); $args = array('post_type' => 'syn_rest_meal', 'post_status' => 'publish', 'posts_per_page' => -1, 'post__in' => explode(',', $ids)); $query = new \WP_Query($args); $html = ''; ob_start(); if ($query->have_posts()) { ?> <div class="syntaxthemes_restaurant_menu"> <ul class="syn-restaurant-menu"> <?php while ($query->have_posts()) { $query->the_post(); $post_id = get_the_ID(); $image = ''; if ($show_image === 'true') { $image = get_the_post_thumbnail(get_the_ID(), $image_size); } $currency_symbol = get_option($syn_restaurant_config->plugin_prefix . 'currency_symbol', '£'); $full_price = get_post_meta($post_id, 'full_price', true); $small_plate_price = get_post_meta($post_id, 'small_plate_price', true); $display_price = get_post_meta($post_id, 'display_price', true); $new_addition = get_post_meta($post_id, 'new_addition', true); $calorie_count = get_post_meta($post_id, 'calorie_count', true); $healthy_option = get_post_meta($post_id, 'healthy_option', true); $gluten_free = get_post_meta($post_id, 'gluten_free', true); $spice_rating = get_post_meta($post_id, 'spice_rating', true); ?> <li class="restaurant-menu-item"> <?php echo $image; ?> <h4 class="syn-menu-title"> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </h4> <div class="syn-menu-content"> <div class="syn-menu-excerpt"><?php the_excerpt(); ?> </div> <?php if ($full_price && $full_price !== '0.00' && $display_price === 'on') { ?> <span class="syn-menu-price"><?php echo $currency_symbol . $full_price; ?> </span> <?php } ?> <div class="syn-menu-properties"> <?php if ($new_addition) { ?> <span class="syn-new-addition"> <?php echo $new_addition === 'on' ? __('New', 'syn_restaurant_plugin') : ''; ?> </span> <?php } ?> <?php if ($small_plate_price && $small_plate_price !== '0.00' && $display_price === 'on') { ?> <span class="syn-small-price"> <?php echo __('Small Plate', 'syn_restaurant_plugin') . ' ' . $currency_symbol . $small_plate_price; ?> </span> <?php } ?> <?php if ($calorie_count) { ?> <span class="syn-calorie-count"> <?php echo $calorie_count . __('(kcal)', 'syn_restaurant_plugin'); ?> </span> <?php } ?> <?php if ($healthy_option) { ?> <span class="syn-healthy-option"> <?php echo $healthy_option === 'on' ? __('Healthy Option', 'syn_restaurant_plugin') : ''; ?> </span> <?php } ?> <?php if ($gluten_free) { ?> <span class="syn-gluten-free"> <?php echo $gluten_free === 'on' ? __('Gluten Free', 'syn_restaurant_plugin') : ''; ?> </span> <?php } ?> <?php if ($spice_rating) { ?> <span class="syn-spice-rating"> <?php echo syn_restaurant_menus_get_spice_rating($spice_rating); ?> </span> <?php } ?> </div> </div> </li> <?php } ?> </ul> </div> <?php } return ob_get_clean(); }
echo $calorie_count . __('(kcal)', 'syn_restaurant_plugin'); ?> </span> <span class="syn-healthy-option"> <?php echo $healthy_option === 'on' ? __('Healthy Option', 'syn_restaurant_plugin') : ''; ?> </span> <span class="syn-gluten-free"> <?php echo $gluten_free === 'on' ? __('Gluten Free', 'syn_restaurant_plugin') : ''; ?> </span> <span class="syn-spice-rating"> <?php echo syn_restaurant_menus_get_spice_rating($spice_rating); ?> </span> </div> <div class="entry-content"> <?php the_content(); ?> <?php wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'syn_restaurant_plugin'), 'after' => '</div>')); ?> </div><!-- .entry-content --> <footer class="entry-meta"> <?php edit_post_link(__('Edit', 'syn_restaurant_plugin'), '<span class="edit-link">', '</span>');