1

I'm using the WP Alchemy Metabox PHP class (www.farinspace.com/wpalchemy-metabox/) to add a custom meta box with a radio select to a custom post type. The code below shows the code I'm using for the meta box, which works great.

Does anyone know how I could set the first value, 'none', as default checked?

<label>Feature project for category?</label>

<?php $feature_cats = array('none', 'courtyard-gardens', 'external-commercial', 'internal-commercial', 'internal-domestic', 'international', 'show-gardens'); ?>

<?php foreach ($feature_cats as $i => $feature_cat): ?>
    <input type="radio" name="<?php $mb->the_name(); ?>" value="<?php echo $feature_cat; ?>"<?php $mb->the_radio_state($feature_cat); ?>/> <?php echo $feature_cat; ?><br/>
<?php endforeach; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.