<?php

/*
 * Spacer
 */

if (!function_exists('xs_extra_space')) {

    function xs_extra_space($atts) {

        extract(shortcode_atts(array(
            'class' => '',
            'margin_bottom' => '',
            'margin_top' => ''
                        ), $atts));

        /* create style */
        $style = 'style="';

        if (!empty($margin_bottom)) {
            $margin_bottom = is_numeric($margin_bottom) ? $margin_bottom . 'px' : $margin_bottom;
            $style .= 'margin-bottom: ' . $margin_bottom . ';';
        }

        if (!empty($margin_top)) {
            $margin_top = is_numeric($margin_top) ? $margin_top . 'px' : $margin_top;
            $style .= 'margin-top: ' . $margin_top . ';';
        }

        $style .= '"';

        return '<div class="ut-spacer ' . $class . '" ' . $style . '></div>';
    }

    add_shortcode('xs_space', 'xs_extra_space');
}