function widget($args, $instance) { global $sc_recipes_post_type, $sc_theme_globals; $featured_recipes_page_url = $sc_theme_globals->get_featured_recipes_page_url(); extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : __('Display featured recipe', 'socialchef')); $sort_by = isset($instance['sort_by']) ? (int) $instance['sort_by'] : 'title'; $sort_descending = isset($instance['sort_by']) && $instance['sort_descending'] == '1'; $order = $sort_descending ? 'DESC' : 'ASC'; $recipe_category_ids = isset($instance['recipe_category_ids']) ? (array) $instance['recipe_category_ids'] : array(); $recipe_difficulty_ids = isset($instance['recipe_difficulty_ids']) ? (array) $instance['recipe_difficulty_ids'] : array(); $recipe_meal_course_ids = isset($instance['recipe_meal_course_ids']) ? (array) $instance['recipe_meal_course_ids'] : array(); $recipe_results = $sc_recipes_post_type->list_recipes(1, 1, $sort_by, $order, $recipe_meal_course_ids, $recipe_difficulty_ids, $recipe_category_ids, array(), array(), true); ?> <div class="featured two-third"> <header class="s-title"> <?php echo $before_title . $title . $after_title; ?> </header><?php if (count($recipe_results) > 0 && $recipe_results['total'] > 0) { ?> <article class="entry"><?php $recipes = $recipe_results['results']; $recipe = $recipes[0]; $recipe_id = $recipe->ID; $recipe_obj = new sc_recipe($recipe); $recipe_difficulty = $recipe_obj->get_difficulty(); $recipe_comments = get_comments_number($recipe_id); $main_image = $recipe_obj->get_main_image('original'); if (!empty($main_image)) { ?> <figure> <img src="<?php echo esc_url($recipe_obj->get_main_image()); ?> " alt="<?php echo esc_attr($recipe_obj->get_title()); ?> " /> <figcaption><a href="<?php echo esc_url($recipe_obj->get_permalink()); ?> "><i class="ico i-view"></i> <span><?php _e('View recipe', 'socialchef'); ?> </span></a></figcaption> </figure> <?php } ?> <div class="container"> <h2><a href="<?php echo esc_url($recipe_obj->get_permalink()); ?> "><?php echo $recipe_obj->get_title(); ?> </a></h2> <p><?php echo $recipe_obj->get_excerpt(); ?> </p> <div class="actions"> <div> <a href="<?php echo esc_url($recipe_obj->get_permalink()); ?> " class="button"><?php _e('See the full recipe', 'socialchef'); ?> </a> <div class="more"><a href="<?php echo esc_url($featured_recipes_page_url); ?> "><?php _e('See past featured recipes', 'socialchef'); ?> </a></div> </div> </div> </div> </article><?php } ?> </div><!--/featured--> <?php }
"><i class="ico eldorado_heart"></i> <span><?php _e('Je m’intéresse', 'socialchef'); ?> </span></a> </div> <div class="print"> <a class="" onclick="window.print();" href="#"><i class="ico eldorado_print"></i> <span><?php _e('Imprimer l\'offre', 'socialchef'); ?> </span></a> </div> </div><!--// one-third --> <!--two-third--> <div class="two-third"> <?php $main_image = $recipe_obj->get_main_image('content-image'); if (!empty($main_image)) { ?> <div class="image"><img itemprop="image" src="<?php echo esc_url($main_image); ?> " alt="<?php the_title(); ?> " /></div> <?php } ?> <?php if (strlen($post->post_content) > 0) { ?>
<a class="edit" href="<?php echo esc_url($sc_theme_globals->get_submit_recipes_url()); ?> ?fesid=<?php echo urlencode($recipe_id); ?> " title="<?php _e('Edit recipe', 'socialchef'); ?> "><?php _e('Edit recipe', 'socialchef'); ?> </a> <?php } $main_image = $recipe_obj->get_main_image('thumb-image'); if (!empty($main_image)) { ?> <figure> <img src="<?php echo esc_url($main_image); ?> " alt="<?php the_title(); ?> " /> <figcaption><a href="<?php echo esc_url($recipe_obj->get_permalink()); ?> "><i class="ico i-view"></i> <span><?php _e('View recipe', 'socialchef');