git-svn-id: https://192.168.0.254/svn/Proyectos.EstudioJuridicoAlmagro_Web/trunk@3 c22fe52d-42d7-ba4f-95f7-33effcf65713
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* displays a button
|
|
*/
|
|
|
|
function wpv_shortcode_button($atts, $content = null, $code) {
|
|
extract(shortcode_atts(array(
|
|
'id' => false,
|
|
'class' => false,
|
|
'size' => 'small',
|
|
'font' => '',
|
|
'link' => '',
|
|
'linktarget' => '',
|
|
'color' => '',
|
|
'bgcolor' => '',
|
|
'align' => false,
|
|
), $atts));
|
|
|
|
$id = $id ? ' id="' . $id . '"' : '';
|
|
$class = $class ? ' '.$class : ' button';
|
|
$link = $link ? ' href="' . $link . '"' : '';
|
|
$linktarget = $linktarget ? ' target="' . $linktarget . '"' : '';
|
|
|
|
// inline styles for the button
|
|
$color = $color ? "color: $color;" : '';
|
|
$font = $font ? "font-size: {$font}px;" : '';
|
|
|
|
$style = ($color != '' || $font != '')? " style='$color $font'" : '';
|
|
|
|
$aligncss = ($align != 'center') ? ' align'.$align : '';
|
|
|
|
$content = '<a'.
|
|
$id.
|
|
$link.
|
|
$linktarget.
|
|
$style.
|
|
' class="'.
|
|
"$size $bgcolor $class $aligncss".
|
|
'"><span>' . trim($content) . '</span></a>';
|
|
|
|
$content = "[raw]".$content."[/raw]";
|
|
|
|
if($align === 'center')
|
|
return '<p class="center">'.$content.'</p>';
|
|
else
|
|
return $content;
|
|
}
|
|
add_shortcode('button', 'wpv_shortcode_button'); |