<?php

/**
 * Initialize the custom Meta Boxes. 
 */
add_action('admin_init', 'xs_sponsor_meta_boxes');

/**
 * Meta Boxes demo code.
 *
 * You can find all the available option types in theme-options.php.
 *
 * @return    void
 * @since     2.3.0
 */
function xs_sponsor_meta_boxes() {

    /**
     * Create a custom meta boxes array that we pass to 
     * the OptionTree Meta Box API Class.
     */
    $sponsor_meta_box = array(
        'id' => 'xs_sponsor_meta_box',
        'title' => __('Sponsor Image', 'xs'),
        'desc' => '',
        'pages' => array('xs_sponsor'),
        'context' => 'normal',
        'priority' => 'high',
        'fields' => array(
            array(
                'label' => __('Link', 'xs'),
                'id' => 'xs_sponsor_link',
                'type' => 'text',
                'desc' => '',
                'std' => '#'
            ),
            array(
                'label' => __('Upload your image here ( <small>you can also use external links</small> )', 'xs'),
                'id' => 'xs_sponsor_image',
                'type' => 'upload',
                'desc' => '',
                'std' => ''
            )
        )
    );

    /**
     * Register our meta boxes using the 
     * ot_register_meta_box() function.
     */
    if (function_exists('ot_register_meta_box')) {
        ot_register_meta_box($sponsor_meta_box);
    }
}
