Example #1
0
 /**
  * PB Item Button
  */
 function st_button_func($atts, $content = '')
 {
     $atts = shortcode_atts(array('button_label' => '', 'link' => '', 'style' => 'default', 'custom_bg_color' => '', 'custom_label_color' => '', 'size' => '', 'position' => 'default', 'link_target' => '_self', 'icon' => '', 'margin_top' => '', 'margin_bottom' => '', 'is_block' => '', 'id' => '', 'slug' => '', 'item_type' => '', 'type' => '', 'url' => ''), $atts);
     extract($atts);
     $link = st_create_link($atts);
     $html = $class = '';
     $class = 'btn ' . esc_attr($size) . ' ';
     $class .= $style == 'custom' && $custom_label_color != '' ? 'btn-custom ' : 'btn-' . $style;
     if ($is_block == 1) {
         $class .= ' btn-block ';
     }
     $html .= $position != 'default' ? '<div class="btn-wrap align-' . esc_attr($position) . '">' : '';
     $html .= '<a href="' . $link . '" target="' . $link_target . '" class="' . trim($class) . '" ';
     $html .= 'style="';
     $html .= $style == 'custom' && $custom_bg_color != '' ? 'background-color:' . $custom_bg_color . '; background-image: none;' : '';
     $html .= $style == 'custom' && $custom_label_color != '' ? 'color:' . $custom_label_color . ';' : '';
     $html .= $margin_top !== '' && is_numeric($margin_top) ? " margin-top:{$margin_top}px;" : '';
     $html .= $margin_bottom !== '' && is_numeric($margin_bottom) ? " margin-bottom:{$margin_bottom}px; " : '';
     $html .= '"';
     $html .= '>';
     $html .= $icon != '' ? '<i class="' . esc_attr($icon) . '"></i>' : '';
     $html .= $button_label;
     $html .= "</a>";
     $html .= $position != 'default' ? '</div>' : '';
     $html = $button_label == '' && $icon == '' ? '' : $html;
     $html = apply_filters('st_button_func', $html, $atts);
     return $html;
 }
Example #2
0
function stpb_input_link($name = '', $save_value = '', $attr = '', $real_name = false)
{
    $options = array('custom' => __('Custom Link', 'smooththemes'), 'post_type' => __('Content Elements', 'smooththemes'), 'taxonomy' => __('Taxonomies', 'smooththemes'));
    // echo var_dump( get_taxonomies( false, 'objects' ) );
    $link_data = array();
    if ($save_value != '') {
        $link_data = (array) json_decode($save_value);
    }
    ?>
    <div class="input-link">
        <input type="hidden"  data-name="<?php 
    echo $name;
    ?>
" <?php 
    echo $attr;
    ?>
 <?php 
    echo $real_name === true ? 'name="' . $name . '" ' : '';
    ?>
 class="stpt-input text link-data" value="<?php 
    echo esc_attr($save_value);
    ?>
">

        <div class="preview-link">
            <a class="change button-secondary"><?php 
    _e('Change', 'smooththemes');
    ?>
</a>
            <strong class="url"><?php 
    echo st_create_link($link_data, 'a');
    ?>
</strong>
        </div>

        <div class="box-link">
            <select class="link-type">
                <?php 
    foreach ($options as $k => $op) {
        $selected = "";
        if ($save_value == $k) {
            $selected = ' selected="selected" ';
        }
        echo '<option ' . $selected . 'value="' . esc_attr($k) . '" >' . esc_html($op) . '</option>';
    }
    ?>
            </select>

            <div class="ajax-items"></div>
            <div class="ajax-select-link"></div>

           <p class="custom-link">
               <b><?php 
    _e('Custom link', 'smooththemes');
    ?>
</b>
               <input type="text" class="stpt-input text custom-link" value="<?php 
    echo esc_attr($link_data['url']);
    ?>
">
           </p>

            <a class="link-close button-primary"><?php 
    _e('Ok', 'smooththemes');
    ?>
</a>
            <a class="link-cancel button-secondary"><?php 
    _e('Cancel', 'smooththemes');
    ?>
</a>
        </div>

    </div>

<?php 
}