function get_the_recipe() { // determine if post has a recipe if (has_recipress_recipe() && recipress_output()) { // create the array $recipe['before'] = '<div class="hrecipe ' . recipress_theme() . '" id="recipress_recipe">'; $recipe['title'] = '<h2 class="fn">' . recipress_recipe('title') . '</h2>'; $recipe['photo'] = recipress_recipe('photo', 'class=alignright photo recipress_thumb'); $recipe['meta'] = '<p class="seo_only">' . __('By', 'recipress') . ' <span class="author">' . get_the_author() . '</span> ' . __('Published:', 'recipress') . ' <span class="published updated">' . get_the_date('F j, Y') . '<span class="value-title" title="' . get_the_date('c') . '"></span></span></p>'; // details $recipe['details_before'] = '<ul class="recipe-details">'; if (recipress_recipe('yield')) { $recipe['yield'] = '<li><b>' . __('Yield:', 'recipress') . '</b> <span class="yield">' . recipress_recipe('yield') . '</span></li>'; } if (recipress_recipe('cost')) { $recipe['cost'] = '<li><b>' . __('Cost:', 'recipress') . '</b> <span class="cost">' . recipress_recipe('cost') . '</span></li>'; } if (recipress_recipe('prep_time') && recipress_recipe('cook_time')) { $recipe['clear_items'] = '<li class="clear_items"></li>'; } if (recipress_recipe('prep_time')) { $recipe['prep_time'] = '<li><b>' . __('Prep:', 'recipress') . '</b> <span class="preptime"><span class="value-title" title="' . recipress_recipe('prep_time', 'iso') . '"></span>' . recipress_recipe('prep_time', 'mins') . '</span></li>'; } if (recipress_recipe('cook_time')) { $recipe['cook_time'] = '<li><b>' . __('Cook:', 'recipress') . '</b> <span class="cooktime"><span class="value-title" title="' . recipress_recipe('cook_time', 'iso') . '"></span>' . recipress_recipe('cook_time', 'mins') . '</span></li>'; } if (recipress_recipe('prep_time') && recipress_recipe('cook_time')) { $recipe['ready_time'] = '<li><b>' . __('Ready In:', 'recipress') . '</b> <span class="duration"><span class="value-title" title="' . recipress_recipe('ready_time', 'iso') . '"></span>' . recipress_recipe('ready_time', 'mins') . '</span></li>'; } $recipe['details_after'] = '</ul>'; // summary $summary = recipress_recipe('summary'); if (!$summary) { $recipe['summary'] = '<p class="summary seo_only">' . recipress_gen_summary() . '</p>'; } else { $recipe['summary'] = '<p class="summary">' . $summary . '</p>'; } // indredients $recipe['ingredients_title'] = '<h3>' . __('Ingredients', 'recipress') . '</h3>'; $recipe['ingredients'] = recipress_ingredients_list(); // instructions $recipe['instructions_title'] = '<h3>' . __('Instructions', 'recipress') . '</h3>'; $recipe['instructions'] = recipress_instructions_list(); // taxonomies $recipe['taxonomies_before'] = '<ul class="recipe-taxes">'; $recipe['cuisine'] = recipress_recipe('cuisine', '<li><b>' . __('Cuisine', 'recipress') . ':</b> ', ', ', '</li>'); $recipe['course'] = recipress_recipe('course', '<li><b>' . __('Course:', 'recipress') . '</b> ', ', ', '</li>'); $recipe['skill_level'] = recipress_recipe('skill_level', '<li><b>' . __('Skill Level', 'recipress') . ':</b> ', ', ', '</li>'); $recipe['taxonomies_after'] = '</ul>'; // close $recipe['credit'] = recipress_credit(); $recipe['after'] = '</div>'; // filter and return the recipe $recipe = apply_filters('the_recipe', $recipe); return implode('', $recipe); } }
function recipress_instructions_list() { $instructions = recipress_recipe('instructions'); $output = '<ol class="instructions">'; foreach ($instructions as $instruction) { $size = recipress_options('instruction_image_size'); if (!isset($size)) { $size = 'large'; } $image = $instruction['image'] != '' ? wp_get_attachment_image($instruction['image'], $size, false, array('class' => 'align-' . $size)) : ''; $output .= '<li>'; if ($size == 'thumbnail' || $size == 'medium') { $output .= $image; } $output .= $instruction['description']; if ($size == 'large' || $size == 'full') { $output .= '<br />' . $image; } $output .= '</li>'; } $output .= '</ol>'; return $output; }
function get_recipress_recent($atts) { extract(shortcode_atts(array('num' => 5, 'image' => false), $atts)); global $post; $args = array('meta_key' => 'hasRecipe', 'meta_value' => 'Yes', 'posts_per_page' => $num); $recipes = new WP_query($args); if ($recipes->have_posts()) { $output = '<ul class="recipress-recent">'; while ($recipes->have_posts()) { $recipes->the_post(); $output .= '<li class="clear_items">'; $output .= '<a href="' . get_permalink() . '">'; if ($image == true) { $output .= recipress_recipe('photo', 'class=recipress-thumb alignleft'); } $output .= '<strong>' . recipress_recipe('title') . '</strong></a></li>'; } $output .= '</ul>'; } else { $output = '<p>' . __('No recipes found.', 'recipress') . '</p>'; } wp_reset_postdata(); return $output; }