Example #1
0
 function hb_li_shortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('class' => '', 'icon' => '', 'color' => ''), $atts));
     $classes = array();
     $color = hb_sanitize_hex_color($color);
     $color = $color ? sprintf(' style="color:%s;"', esc_attr($color)) : '';
     if ('' !== $icon) {
         $classes[] = 'have-icon';
         $content = sprintf('<i class="icon-li %s"></i>%s', esc_attr($icon), $content);
     }
     if ('' !== $class) {
         $classes[] = $class;
     }
     $classes = !empty($classes) ? sprintf(' class="' . esc_attr(implode(' ', $classes)) . '"') : '';
     return '<li' . $classes . $color . '>' . do_shortcode($content) . '</li>';
 }
Example #2
0
 function fm_member_shortcode($atts)
 {
     extract(shortcode_atts(array('img' => '', 'name' => '', 'title' => '', 'color' => '', 'class' => ''), $atts));
     $output = '<div class="team-item hb-animate ' . esc_attr($class) . '" data-animation="fadeIn">';
     $output .= '<div class="team-member clearfix">';
     if ($img) {
         $output .= '<div class="memeber-avatar"><img src="' . esc_url($img) . '" alt="' . esc_attr($name) . '" /></div>';
     }
     $output .= '<div class="memeber-name">';
     if ($name) {
         $output .= '<h3>' . $name . '</h3>';
     }
     if ($title) {
         $color = hb_sanitize_hex_color($color);
         $color = $color ? 'style="color:' . $color . ';"' : '';
         $output .= '<span ' . $color . '>' . $title . '</span>';
     }
     $output .= '</div>';
     $output .= '</div>';
     $output .= '</div>';
     return $output;
 }
Example #3
0
/**
 *  Save the data when the product gets updated
 *
 * @return array
 */
function hb_colorpicker_save_product($product_id)
{
    // If this is a auto save do nothing, we only save when update button is clicked
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    if (isset($_POST['_product_color']) && !empty($_POST['_product_color'])) {
        $color = hb_sanitize_hex_color($_POST['_product_color']);
        if ($color) {
            update_post_meta($product_id, '_product_color', $color);
        }
    } else {
        delete_post_meta($product_id, '_product_color');
    }
}