*/ $atts = shortcode_atts(array('text' => __('Click Me', 'us'), 'link' => '', 'color' => 'primary', 'bg_color' => '', 'text_color' => '', 'style' => 'raised', 'icon' => '', 'iconpos' => 'left', 'size' => 'medium', 'align' => 'left', 'el_class' => ''), $atts); // .w-btn container additional classes and inner CSS-styles $classes = ''; $inner_css = ''; $classes .= ' style_' . $atts['style'] . ' size_' . $atts['size']; $classes .= ' color_' . $atts['color']; if ($atts['color'] == 'custom') { if ($atts['bg_color'] != '') { $inner_css .= 'background-color: ' . $atts['bg_color'] . ';'; } if ($atts['text_color'] != '') { $inner_css .= 'color: ' . $atts['text_color'] . ';'; } } $link = us_vc_build_link($atts['link']); $icon_html = ''; $atts['icon'] = trim($atts['icon']); if ($atts['icon'] != '') { $icon_html = '<i class="' . us_prepare_icon_class($atts['icon']) . '"></i>'; $classes .= ' icon_at' . $atts['iconpos']; } else { $classes .= ' icon_none'; } $link_target = $link['target'] == '_blank' ? ' target="_blank"' : ''; $link_title = empty($link['title']) ? '' : ' title="' . esc_attr($link['title']) . '"'; // Additional classes if ($atts['el_class'] != '') { $classes .= ' ' . $atts['el_class']; } $output = '<div class="w-btn-wrapper align_' . $atts['align'] . '">';
// TODO Move placeholder URL to some config global $us_template_directory_uri; $placeholder_url = $us_template_directory_uri . '/img/placeholder/500x500.gif'; $image_html = '<img src="' . $placeholder_url . '" width="500" height="500" alt="">'; } else { $image_html = '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="">'; if ($atts['lightbox']) { $link['url'] = wp_get_attachment_image_src($img_id, 'full'); $link['url'] = $link['url'] ? $link['url'][0] : $image[0]; $link['ref'] = 'magnificPopup'; } } $link_target = ''; if (!$atts['lightbox'] and !empty($atts['link'])) { // Passing params from vc_link field type $link = array_merge($link, us_vc_build_link($atts['link'])); } if (!empty($link['url'])) { $link_html = '<a href="' . esc_url($link['url']) . '"'; unset($link['url']); foreach ($link as $key => $value) { $link_html .= ' ' . $key . '="' . esc_attr($value) . '"'; } $link_html .= '>'; $image_html = $link_html . $image_html . '</a>'; } if ($atts['align'] != '') { $classes .= ' align_' . $atts['align']; } if ($atts['animate'] != '') { $classes .= ' animate_' . $atts['animate'];
$btn_inner_css .= 'background-color: ' . $atts[$prefix . '_bg_color'] . ';'; } if ($atts[$prefix . '_text_color'] != '') { $btn_inner_css .= 'color: ' . $atts[$prefix . '_text_color'] . ';'; } } $btn_classes .= ' style_' . $atts[$prefix . '_style']; $btn_classes .= ' size_' . $atts[$prefix . '_size']; $icon_html = ''; if (!empty($atts[$prefix . '_icon'])) { $btn_classes .= ' icon_at' . $atts[$prefix . '_iconpos']; $icon_html = '<i class="' . us_prepare_icon_class($atts[$prefix . '_icon']) . '"></i>'; } else { $btn_classes .= ' icon_none'; } $link = us_vc_build_link($atts[$prefix . '_link']); $buttons[$prefix] = '<a class="w-btn' . $btn_classes . '" href="' . $link['url'] . '"'; $buttons[$prefix] .= $link['target'] == '_blank' ? ' target="_blank"' : ''; $buttons[$prefix] .= empty($link['title']) ? '' : ' title="' . esc_attr($link['title']) . '"'; if (!empty($btn_inner_css)) { $buttons[$prefix] .= ' style="' . $btn_inner_css . '"'; } $buttons[$prefix] .= '>' . $icon_html . '<label>' . $atts[$prefix . '_label'] . '</label></a>'; } if (!empty($inner_css)) { $inner_css = ' style="' . $inner_css . '"'; } $output = '<div class="w-actionbox' . $classes . '"' . $inner_css . '><div class="w-actionbox-text">'; if (!empty($atts['title'])) { $output .= '<h2>' . html_entity_decode($atts['title']) . '</h2>'; }
if ($item['btn_bg_color'] != '') { $btn_inner_css .= 'background-color: ' . $item['btn_bg_color'] . ';'; } if ($item['btn_text_color'] != '') { $btn_inner_css .= 'color: ' . $item['btn_text_color'] . ';'; } } $icon_html = ''; $item['btn_icon'] = trim($item['btn_icon']); if ($item['btn_icon'] != '') { $icon_html = '<i class="' . us_prepare_icon_class($item['btn_icon']) . '"></i>'; $btn_classes .= ' icon_at' . $item['btn_iconpos']; } else { $btn_classes .= ' icon_none'; } $btn_link = us_vc_build_link($item['btn_link']); $btn_link_target = $btn_link['target'] == '_blank' ? ' target="_blank"' : ''; $btn_link_title = empty($btn_link['title']) ? '' : ' title="' . esc_attr($btn_link['title']) . '"'; $items_html .= '<div class="w-pricing-item-footer">'; $items_html .= '<a class="w-btn' . $btn_classes . '" href="' . esc_url($btn_link['url']) . '"' . $btn_link_target . $btn_link_title; if (!empty($btn_inner_css)) { $items_html .= ' style="' . $btn_inner_css . '"'; } $items_html .= '>'; $items_html .= $icon_html . '<label>' . $item['btn_text'] . '</label></a>'; $items_html .= '</div>'; } $items_html .= '</div></div>'; } $output = '<div class="w-pricing' . $classes . '">' . $items_html . '</div>'; echo $output;