Add custom fields with the WPAlchemy MetaBox PHP Class

Using custom fields in WordPress is imperative, the built in custom field UI has much to wish for. Helper Class to rescue.

There are a ton of custom meta box plugins. This is not a plugin, but a PHP class, giving you all the power how things are presented. Download and get to know it here.

Sometimes (almost always) when adding something to page via custom field it is good to have a if and else in case the field is left empty.


$custom_metabox->the_meta();
$custom_metabox->the_field('_material');
$my_custom_value = $custom_metabox->get_the_value();
    //if the $my_custom_value is not empty
    if(!empty($my_custom_value)) {
        echo $custom_metabox->get_the_value();
} else {
    //if it is empty
    echo '--';
}

Club-Mate, the beverage → club-mate.fi