function button_func($atts, $content) { //extract short code attr extract(shortcode_atts(array('href' => '', 'align' => 'left', 'bg_color' => '#cccccc', 'text_color' => '#444444', 'size' => 'small', 'style' => '', 'color' => '', 'target' => '_self'), $atts)); if (!empty($color)) { switch (strtolower($color)) { case 'black': $bg_color = '#000000'; $text_color = '#ffffff'; break; case 'grey': $bg_color = '#666666'; $text_color = '#ffffff'; break; case 'white': $bg_color = '#f5f5f5'; $text_color = '#444444'; break; case 'blue': $bg_color = '#004a80'; $text_color = '#ffffff'; break; case 'yellow': $bg_color = '#f9b601'; $text_color = '#ffffff'; break; case 'red': $bg_color = '#9e0b0f'; $text_color = '#ffffff'; break; case 'orange': $bg_color = '#fe7201'; $text_color = '#ffffff'; break; case 'green': $bg_color = '#7aad34'; $text_color = '#ffffff'; break; case 'pink': $bg_color = '#d2027d'; $text_color = '#ffffff'; break; case 'purple': $bg_color = '#582280'; $text_color = '#ffffff'; break; } } $bg_color_light = '#' . hex_lighter(substr($bg_color, 1), 35); $border_color = '#' . hex_darker(substr($bg_color, 1), 10); $return_html = '<input type="button" class="button ' . $size . ' ' . $align . '" style="background: -webkit-gradient(linear, left top, left bottom, from(' . $bg_color_light . '), to(' . $bg_color . '));background: -moz-linear-gradient(top, ' . $bg_color_light . ', ' . $bg_color . ');filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'' . $bg_color_light . '\', endColorstr=\'' . $bg_color . '\');border:1px solid ' . $border_color . ';color:' . $text_color . ';' . $style . '" value="' . $content . '"'; if (!empty($href)) { $return_html .= ' onclick="window.open(\'' . $href . '\', \'' . $target . '\')"'; } $return_html .= '/>'; return $return_html; }
function tg_button_func($atts, $content) { extract(shortcode_atts(array('href' => '', 'align' => '', 'bg_color' => '', 'text_color' => '', 'size' => 'small', 'style' => '', 'color' => '', 'shadow' => '', 'target' => '_self'), $atts)); if (!empty($color)) { switch (strtolower($color)) { case 'black': $bg_color = '#000000'; $text_color = '#ffffff'; break; case 'grey': $bg_color = '#97a2a2'; $text_color = '#ffffff'; break; case 'white': $bg_color = '#f5f5f5'; $text_color = '#444444'; break; case 'blue': $bg_color = '#5babe1'; $text_color = '#ffffff'; break; case 'dark blue': $bg_color = '#2980b9'; $text_color = '#ffffff'; break; case 'yellow': $bg_color = '#f2ce3e'; $text_color = '#ffffff'; break; case 'red': $bg_color = '#cb5f54'; $text_color = '#ffffff'; break; case 'orange': $bg_color = '#f4ae40'; $text_color = '#ffffff'; break; case 'green': $bg_color = '#76bb2c'; $text_color = '#ffffff'; break; case 'emerald': $bg_color = '#4ec380'; $text_color = '#ffffff'; break; case 'pink': $bg_color = '#ea6288'; $text_color = '#ffffff'; break; case 'purple': $bg_color = '#a368bc'; $text_color = '#ffffff'; break; } } if (!empty($bg_color)) { $border_color = $bg_color; } else { $border_color = 'transparent'; } //Get darker shadow color $shadow_color = '#' . hex_darker(substr($bg_color, 1), 12); if (!empty($bg_color)) { $return_html = '<a class="button ' . esc_attr($size) . ' ' . esc_attr($align) . '" style="background-color:' . esc_attr($bg_color) . ' !important;color:' . esc_attr($text_color) . ' !important;border:1px solid ' . esc_attr($bg_color) . ' !important;'; if (!empty($shadow)) { $return_html .= 'box-shadow: 0 3px 0 0 ' . esc_attr($shadow_color) . ';'; } $return_html .= $style . '"'; } else { $return_html = '<a class="button ' . esc_attr($size) . ' ' . esc_attr($align) . '"'; } if (!empty($href)) { $return_html .= ' onclick="window.open(\'' . esc_url($href) . '\', \'' . esc_js($target) . '\')"'; } $return_html .= '>' . $content . '</a>'; return $return_html; }
function tg_button_func($atts, $content) { extract(shortcode_atts(array('href' => '', 'align' => '', 'bg_color' => '', 'text_color' => '', 'size' => 'small', 'style' => '', 'color' => '', 'target' => '_self'), $atts)); if (!empty($color)) { switch (strtolower($color)) { case 'black': $bg_color = '#000000'; $text_color = '#ffffff'; break; case 'grey': $bg_color = '#7F8C8D'; $text_color = '#ffffff'; break; case 'white': $bg_color = '#f5f5f5'; $text_color = '#444444'; break; case 'blue': $bg_color = '#3498DB'; $text_color = '#ffffff'; break; case 'yellow': $bg_color = '#F1C40F'; $text_color = '#ffffff'; break; case 'red': $bg_color = '#E74C3C'; $text_color = '#ffffff'; break; case 'orange': $bg_color = '#ff9900'; $text_color = '#ffffff'; break; case 'green': $bg_color = '#2ECC71'; $text_color = '#ffffff'; break; case 'pink': $bg_color = '#ed6280'; $text_color = '#ffffff'; break; case 'purple': $bg_color = '#9B59B6'; $text_color = '#ffffff'; break; } } if (!empty($bg_color)) { $border_color = $bg_color; } else { $border_color = 'transparent'; } //Get darker shadow color $shadow_color = '#' . hex_darker(substr($bg_color, 1), 12); if (!empty($bg_color)) { $return_html = '<a class="button ' . $size . ' ' . $align . '" style="background-color:' . $bg_color . ' !important;color:' . $text_color . ' !important;border:1px solid ' . $bg_color . ' !important;' . $style . '"'; } else { $return_html = '<a class="button ' . $size . ' ' . $align . '"'; } if (!empty($href)) { $return_html .= ' onclick="window.open(\'' . $href . '\', \'' . $target . '\')"'; } $return_html .= '>' . $content . '</a>'; return $return_html; }
function button_func($atts, $content) { //extract short code attr extract(shortcode_atts(array('href' => '', 'align' => '', 'bg_color' => '', 'text_color' => '', 'size' => 'small', 'style' => '', 'color' => '', 'target' => '_self'), $atts)); if (!empty($color)) { switch (strtolower($color)) { case 'black': $bg_color = '#000000'; $text_color = '#ffffff'; break; case 'grey': $bg_color = '#666666'; $text_color = '#ffffff'; break; case 'white': $bg_color = '#f5f5f5'; $text_color = '#444444'; break; case 'blue': $bg_color = '#004a80'; $text_color = '#ffffff'; break; case 'yellow': $bg_color = '#f9b601'; $text_color = '#ffffff'; break; case 'red': $bg_color = '#9e0b0f'; $text_color = '#ffffff'; break; case 'orange': $bg_color = '#fe7201'; $text_color = '#ffffff'; break; case 'green': $bg_color = '#7aad34'; $text_color = '#ffffff'; break; case 'pink': $bg_color = '#d2027d'; $text_color = '#ffffff'; break; case 'purple': $bg_color = '#582280'; $text_color = '#ffffff'; break; } } if (!empty($bg_color)) { $border_color = '#' . hex_darker(substr($bg_color, 1), 10); } else { $border_color = 'transparent'; } if (!empty($bg_color)) { $return_html = '<a class="button ' . $size . ' ' . $align . '" style="background-color:' . $bg_color . ';border:1px solid ' . $border_color . ';color:' . $text_color . ';' . $style . '"'; } else { $return_html = '<a class="button ' . $size . ' ' . $align . '"'; } if (!empty($href)) { $return_html .= ' onclick="window.open(\'' . $href . '\', \'' . $target . '\')"'; } $return_html .= '>' . $content . '</a>'; return $return_html; }