Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using 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?

    [docs] => Array
        [0] => Array
           [ingredient] => Cheese
        [1] => Array
           [ingredient] => Salt

This is my single.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">
            <input class="text" type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>"/>
            <a href="#" class="dodelete button">Remove</a>

    <?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>


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'),
    'prefix' => '_ingredient_',
    'autosave' => TRUE,
    'template' => get_stylesheet_directory() . '/metaboxes/ingredients-meta.php',
share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.