With custom meta boxes, how would I go about displaying the background image (or color if no image is linked) within the page.
Code for the page where I want data to displayed. I want to apply the background color/image to section id="masthead".
<?php if (get_post_meta($post->ID, '_sqcmb_masthead_select', true)) { ?>
</div><!--end #container .row (from header)-->
<section id="masthead">
<div class="row">
<div class="large-9 large-centered columns">
<?php
$content = get_post_meta( $post->ID, '_sqcmb_masthead_content', true );
echo do_shortcode( $content );
?>
</div><!-- .large- centered columns -->
</div><!-- .row -->
</section><!-- #masthead -->
<!--restart #container .row (from header)--><div id="content" class="row">
<? } else { ?>
<?php } ?>
Code for the custom meta boxes.
/*Metaboxes for masthead section */
$meta_boxes[] = array(
'id' => 'masthead-options',
'title' => 'Masthead Options',
'pages' => array( 'page' ), // Show on Pages
'context' => 'normal',
'priority' => 'high',
'show_names' => true, // Show field names on the left
'fields' => array(
array(
'name' => 'Display Masthead',
'desc' => 'Check this box id you want to display the Masthead Section.',
'id' => $prefix . 'masthead_select',
'type' => 'checkbox',
),
array(
'name' => 'Masthead Content',
'desc' => 'Enter the content of the masthead section here. You can insert media, shortcodes, etc.',
'id' => $prefix . 'masthead_content',
'type' => 'wysiwyg',
'options' => array( 'textarea_rows' => 5, ),
),
array(
'name' => 'Background Color',
'desc' => 'Choose a background color.',
'id' => $prefix . 'masthead_bg_color',
'type' => 'colorpicker',
'std' => '#ffffff'
),
array(
'name' => 'Background Image',
'desc' => 'Upload an image as the background. This will override the Background Color. (optional)',
'id' => $prefix . 'masthead_bg_image',
'type' => 'file',
),
),
);