| 1 |
<?php |
| 2 |
|
| 3 |
/* * ********************************************************* |
| 4 |
* Tooltip |
| 5 |
* ********************************************************* */ |
| 6 |
|
| 7 |
function osc_theme_tooltip($params, $content = 'Tooltip') { |
| 8 |
extract(shortcode_atts(array( |
| 9 |
'type' => '', |
| 10 |
'link' => '', |
| 11 |
'tooltip' => '', |
| 12 |
'style' => '' |
| 13 |
), $params)); |
| 14 |
$out = ''; |
| 15 |
if ($type == 'link') { |
| 16 |
$out = '<a href="' . $link . '" data-placement="' . $style . '" title="' . $tooltip . '" class="osc_tooltip">' . $content . '</a> |
| 17 |
'; |
| 18 |
} elseif ($type == 'button') { |
| 19 |
$out = '<button type="button" data-toggle="tooltip" data-placement="' . $style . '" title="' . $tooltip . '" class="osc_tooltip">' . $content . '</button>'; |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
$out .= " |
| 24 |
<script> |
| 25 |
jQuery(document).ready(function() { |
| 26 |
jQuery('.osc_tooltip').tooltip(); |
| 27 |
}); |
| 28 |
</script> |
| 29 |
"; |
| 30 |
|
| 31 |
return $out; |
| 32 |
} |
| 33 |
|
| 34 |
add_shortcode('tooltip', 'osc_theme_tooltip'); |
| 35 |
|
| 36 |
|