Adding Custom Fields As Meta Boxes With WooFramework

Print Friendly, PDF & Email

I recently encountered a scenario where a client needed to be able to paste different text and HTML onto various posts and have that text display formatted appropriately. The text and HTML needed to display next to the featured image or video, but couldn’t be done through pasting into the actual post body itself. The solution was to setup custom Meta Boxes. The website utilizes the WooFramework, which makes the whole process a snap.

The first step is to setup the Meta Boxes on the backend for the client to paste the text and HTML into. Inside of theme-functions.php, I implemented:

function woo_metaboxes_add($woo_metaboxes) {

if ( ( get_post_type() == ‘woo_video’) || ( !get_post_type() ) ) {

$woo_metaboxes[‘first_field’] = array (
“name” => “first_field”,
“label” => “Field Label”,
“type” => “text”,
“desc” => “Field Description”

$woo_metaboxes[‘second_field’] = array (
“name” => “second_field”,
“label” => “Second Field”,
“type” => “text”,
“desc” => “Field Description”

$woo_metaboxes[‘third_field_html’] = array (
“name” => “third_field_html”,
“label” => “Third Field For HTML”,
“type” => “textarea”,
“desc” => “Field Description”

return $woo_metaboxes;


The code above causes this to display on the Post Admin page (Excuse me blurring out the live text):

Now, with the following code, the Meta Boxes specified above will output onto the front end of the website:

<?php echo get_post_meta($post->ID,’first_field’,true); ?>
<?php echo get_post_meta($post->ID,’second_field’,true); ?>
<?php echo get_post_meta($post->ID,’third_field_html’,true); ?> 

Where ever you place the above code, the filled in Meta Boxes will output their data.

No comments yet.

Leave a Reply