I am using http://www.farinspace.com/wpalchemy-metabox/ and have created my meta boxes and the data is being saved successfully (See below) but I don’t know how to output these ‘ingredients’ on the front end?
Array
(
[docs] => Array
(
[0] => Array
(
[ingredient] => Cheese
)
[1] => Array
(
[ingredient] => Salt
)
)
)
This is my single.php
<?php
global $simple_mb;
$meta = $simple_mb->the_meta();
?>
This is my meta.php
<div class="recipe_ingredients_metabox">
<?php while($mb->have_fields_and_multi('docs')): ?>
<?php $mb->the_group_open(); ?>
<?php $mb->the_field('ingredient'); ?>
<p class="clearfix">
<label>Ingredient</label>
<input class="text" type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/>
<a href="#" class="dodelete button">Remove</a>
</p>
<?php $mb->the_group_close(); ?>
<?php endwhile; ?>
<p style="margin-bottom:15px; padding-top:5px;" class="clearfix"><a href="#" class="docopy-docs button"><?php echo __('Add Ingredient'); ?></a></p>
</div>
This is my functions.php
// Meta WP Alchemy
include_once 'metaboxes/setup.php';
$custom_metabox = $simple_mb = new WPAlchemy_MetaBox(array
(
'id' => '_custom_meta_ingredient',
'title' => 'Recipe Ingredients',
'types' => array('recipe'),
'mode' => WPALCHEMY_MODE_EXTRACT,
'prefix' => '_ingredient_',
'autosave' => TRUE,
'template' => get_stylesheet_directory() . '/metaboxes/ingredients-meta.php',
));