<script> window.recipeId = <?php echo $post->ID; ?> ; window.addToFavoritesText = '<i class="ico eldorado_heart"></i><span><?php _e('Add to favorites', 'socialchef'); ?> </span>'; window.removeFromFavoritesText = '<i class="ico eldorado_heart"></i><span><?php _e('Remove from favorites', 'socialchef'); ?> </span>'; </script> <?php $recipe_obj = new sc_recipe($post); $recipe_id = $recipe_obj->get_id(); $expirationdatets = $recipe_obj->get_post_meta('_expiration-date'); $recipe_Prix = $recipe_obj->get_post_meta('recipe_Prix'); $recipe_Remise = $recipe_obj->get_post_meta('recipe_Remise'); $recipe_difficulty = $recipe_obj->get_difficulty(); if (!empty($recipe_difficulty)) { $recipe_difficulty = $recipe_difficulty->name; } else { $recipe_difficulty = false; } // Generate microformat time values for Schema.org compatibility //$mf_recipe_cooking_time = SocialChef_Theme_Utils::time_to_iso8601_duration(strtotime($recipe_cooking_time . " minutes", 0)); //$mf_recipe_preparation_time = SocialChef_Theme_Utils::time_to_iso8601_duration(strtotime($recipe_preparation_time . " minutes", 0)); $ingredient_results = $sc_recipes_post_type->list_recipe_ingredients($post->ID); if ($sc_theme_globals->enable_nutritional_elements()) {
<?php global $post, $sc_recipe_class, $sc_include_edit_link, $sc_theme_globals; $recipe_id = $post->ID; $recipe_obj = new sc_recipe($post); $recipe_Prix = $recipe_obj->get_post_meta('recipe_Prix'); $recipe_Remise = $recipe_obj->get_post_meta('recipe_Remise'); //$recipe_difficulty = $recipe_obj->get_difficulty(); $recipe_comments = get_comments_number($recipe_id); ?> <!--item--> <div class="entry <?php echo $sc_recipe_class; ?> recipe-item"> <?php if ($sc_include_edit_link) { ?> <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>
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 }
function get_entry_field_value($field_id) { if ($this->entry != null) { if ($this->content_type == 'recipe') { $recipe_obj = new sc_recipe(intval($this->entry_id)); return $recipe_obj->get_field_value($field_id, false); } } return null; }