| @@ -1,23 +1,38 @@ | ||
| 1 | -<?php | |
| 2 | -/* ********************************************************** | |
| 3 | - * BUTTONS | |
| 4 | - * **********************************************************/ | |
| 5 | -function osc_theme_button( $params, $content = null) { | |
| 6 | - extract( shortcode_atts( array( | |
| 7 | - 'title' => 'osCitas', | |
| 8 | - 'link' => '', | |
| 9 | - 'btntag' => 'a', | |
| 10 | - 'class' => '', | |
| 11 | - 'target' => '', | |
| 12 | - ), $params ) ); | |
| 13 | - $out = ''; | |
| 14 | - | |
| 15 | - if ($btntag == 'a') { | |
| 16 | - $out = '<a class="btn '.$class.'" href="'.$link.'" target="'.($target).'">'.$title.'</a>'; | |
| 17 | - } elseif ($btntag == 'button' || $btntag == 'submit') { | |
| 18 | - $out = '<input class="btn '.$class.'" type="'.$btntag.'" value="'.$title.'">'; | |
| 19 | - } | |
| 20 | - return $out; | |
| 21 | -} | |
| 22 | -add_shortcode( 'button', 'osc_theme_button' ); | |
| 23 | - | |
| 1 | +<?php | |
| 2 | + | |
| 3 | +/* * ********************************************************* | |
| 4 | + * BUTTONS | |
| 5 | + * ********************************************************* */ | |
| 6 | + | |
| 7 | +function osc_theme_button($params, $content = null) { | |
| 8 | + extract(shortcode_atts(array( | |
| 9 | + 'title' => 'osCitas', | |
| 10 | + 'link' => '', | |
| 11 | + 'type' => 'link', | |
| 12 | + 'style' => '', | |
| 13 | + 'align' => '', | |
| 14 | + 'target' => '', | |
| 15 | + 'icon' => '', | |
| 16 | + 'class' => '' | |
| 17 | + ), $params)); | |
| 18 | + $out = ''; | |
| 19 | + if($icon!=''){ | |
| 20 | + if($align=='right'){ | |
| 21 | + $value=$title.' <i class="glyphicon '.$icon.'"></i>'; | |
| 22 | + } else{ | |
| 23 | + $value='<i class="glyphicon '.$icon.'"></i> '.$title; | |
| 24 | + } | |
| 25 | + }else{ | |
| 26 | + $value=$title; | |
| 27 | + } | |
| 28 | + $target = ' target="'.($target != 'false' ? '_blank':'_self').'"'; | |
| 29 | + if ($type == 'link') { | |
| 30 | + $out = '<a class="btn ' . $style . ' ' . $class . '" href="' . $link . '" ' . ($target) . '>' . $value . '</a>'; | |
| 31 | + } elseif ($type == 'button') { | |
| 32 | + $out = '<button class="btn ' . $style . ' ' . $class . '" >' . $value . '</button>'; | |
| 33 | + } | |
| 34 | + return $out; | |
| 35 | +} | |
| 36 | + | |
| 37 | +add_shortcode('button', 'osc_theme_button'); | |
| 38 | + | |