';
} else {
$st_callout = '
';
}
$st_callout .= do_shortcode($content);
$st_callout .= '
';
return $st_callout;
}
/**
* Alerts
*
* @since 1.0.0
*
* @param array $atts Standard WordPress shortcode attributes
* @param string $content The enclosed content
* @return string $output Content to output for shortcode
*/
function smpl_shortcode_alert( $atts, $content = null ) {
$default = array(
'class' => '',
'style' => 'info', // 'info','alert','warn','success','idea'
'show_icon' => 'true'
);
extract( shortcode_atts( $default, $atts ) );
// CSS classes
$classes = 'note';
if( in_array( $style, array( 'info','alert','warn','success','download','idea' ) ) || in_array( $class, array( 'info','alert','warn','success','download','idea' ) ) ) {
$classes .= sprintf( ' %s', $style );
$classes .= sprintf( ' %s', $class );
}
if ($show_icon == "false") {
$classes .= ' no-icon';
}
// Start output
$output = sprintf( '
', $classes );
// Finish output
$output .= $content.'
';
return $output;
}
/**
* Divider
*
* @since 1.0.0
*
* @param array $atts Standard WordPress shortcode attributes
* @param string $content The enclosed content
*/
function smpl_shortcode_divider( $atts, $content = null ) {
$default = array(
'style' => 'solid' // dashed, shadow, solid
);
extract( shortcode_atts( $default, $atts ) );
switch ($style) {
case 'solid':
return '
';
break;
case 'dashed':
return '
';
break;
case 'shadow':
return '
';
break;
default:
return '
';
break;
}
}
/**
* Clear Fade
*
* @since 1.0.1
*/
function smpl_shortcode_clearfade() {
return '
';
}
/**
* Blockquote
*
* @since 1.2.0
*
* @param array $atts Standard WordPress shortcode attributes
* @param string $content The enclosed content
*/
function smpl_shortcode_blockquote( $atts, $content = null ) {
extract(shortcode_atts(array(
'quote' => '',
'source' => '', // Source of quote
'source_link' => '', // URL to link source to
'align' => '', // How to align blockquote - left, right
'class' => '' // Any additional CSS classes
),$atts));
$atts = wp_parse_args( $atts, $defaults );
$output .= '
';
$output .= $quote;
if ($source) {
if ($source_link) {
$output .= sprintf( '
%s', $source_link,$source );
} else {
$output .= sprintf( '
— %s', $source );
}
}
$output.= '
';
return $output;
}
/*-----------------------------------------------------------*/
/* Tabs, Accordion, & Toggles
/*-----------------------------------------------------------*/
/**
* Tabs
*
* @since 1.0.0
*
* @param array $atts Standard WordPress shortcode attributes
* @param string $content The enclosed content
* @return string $output Content to output for shortcode
*/
function smpl_shortcode_tabgroup( $atts, $content ){
$GLOBALS['tab_count'] = 0;
do_shortcode( $content );
if( is_array( $GLOBALS['tabs'] ) ){
foreach( $GLOBALS['tabs'] as $tab ){
$tabs[] = '
'.$tab['title'].'';
$panes[] = '
'.$tab['content'].'';
}
$return = "\n".'
'.implode( "\n", $tabs ).'
'."\n".'
'.implode( "\n", $panes ).'
'."\n";
}
return $return;
}
function smpl_shortcode_tab( $atts, $content ){
extract(shortcode_atts(array(
'title' => '%d',
'id' => '%d'),
$atts));
$x = $GLOBALS['tab_count'];
$GLOBALS['tabs'][$x] = array(
'title' => sprintf( $title, $GLOBALS['tab_count']),
'content' => do_shortcode($content),
'id' => $id);
$GLOBALS['tab_count']++;
}
/**
* Accordion
*
* @since 1.0.0
*
* @param array $atts Standard WordPress shortcode attributes
* @param string $content The enclosed content
* @return string $output Content to output for shortcode
*/
function smpl_shortcode_accordion( $atts, $content = null ) {
$accordion_id = uniqid( 'accordion_'.rand() );
$output = sprintf( '
%s
', $accordion_id, do_shortcode( $content ) );
return $output;
}
/**
* Toggles
*
* @since 1.0.0
*
* @param array $atts Standard WordPress shortcode attributes
* @param string $content The enclosed content
* @return string $output Content to output for shortcode
*/
function smpl_shortcode_toggle( $atts, $content = null ) {
$default = array(
'title' => '',
'open' => 'false'
);
extract( shortcode_atts( $default, $atts ) );
// Individual toggle ID
$toggle_id = uniqid( 'toggle_'.rand() );
// Is toggle open?
$classes = 'panel-collapse collapse';
if( $open == 'true' ) {
$classes .= ' in';
}
$output = '
'.$title.'
'.do_shortcode( $content ).'
';
return $output;
}
/*-----------------------------------------------------------------------------------*/
// Responsive YouTube Videos
// Usage: [youtube responsive="true" autoplay="true" controls="true" id="oHg5SJYRHA0" showinfo="true"]
/*-----------------------------------------------------------------------------------*/
// id // video id to embed
// responsive // true or false
// center // true or false
// width // width of video (if not responsive)
// height // height of video (if not responsive)
// autoplay // true or false
// controls // true or false
// showinfo // true or false
function smpl_shortcode_youtube( $atts, $content = null ) {
extract( shortcode_atts( array(
'id' => 'oHg5SJYRHA0',
'responsive' => 'true',
'showinfo' => 'false',
'branding' => 'false',
'hd' => 'true',
'related' => 'false',
'width' => '',
'height' => '',
'center' => 'false',
'autoplay' => '0',
'theme' => 'dark',
'controls' => 'true'),$atts));
$theme = esc_attr($theme);
$show_info = esc_attr($showinfo);
if ($show_info == "true") { $info = '1'; }
if ($show_info == "false") { $info = '0'; }
//$info
$branding = esc_attr($branding);
if ($branding == "false") { $modestbranding = '1'; }
if ($branding == "true") { $modestbranding = '0'; }
//$modestbranding
$related = esc_attr($related);
if ($related == "true") { $related = '1'; }
if ($related == "false") { $related = '0'; }
//$related
$hd = esc_attr($hd);
if ($hd == "true") { $showhd = '1'; }
if ($hd == "false") { $showhd = '0'; }
//$show_hd
$show_info = esc_attr($showinfo);
if ($show_info == "true") { $info = '1'; }
if ($show_info == "false") { $info = '0'; }
//$info
$theme = esc_attr($theme);
//$theme
if (esc_attr($autoplay) == 'true') {$autoplay = '1';}
if (esc_attr($autoplay) == 'false') {$autoplay = '0';}
if (esc_attr($controls) == 'true') {$controls = '1';}
if (esc_attr($controls) == 'false') {$controls = '0';}
if (esc_attr($responsive) == 'true') {$responsive = 'true';}
if (esc_attr($responsive) == 'false') {$responsive = 'false';}
if (esc_attr($center) == 'true') {$center = 'margin:0px auto;';}
if (esc_attr($center) == 'false') {$center = '';}
$video_width = esc_attr($width);
$video_height = esc_attr($height);
if (!isset($video_width) || !isset($video_height)) {
$video = '