'.$content.''; return do_shortcode( $content ); } function smpl_shortcode_legacy_column_last( $atts, $content = null, $tag = '' ) { // Determine width of column $class = ''; switch ( $tag ) { case 'one_sixth_last' : $class .= 'one_sixth last'; break; case 'one_fourth_last' : $class .= 'one_fourth last'; break; case 'one_third_last' : $class .= 'one_third last'; break; case 'one_half_last' : $class .= 'one_half last'; break; case 'two_third_last' : case 'two_thirds_last' : $class .= 'two_thirds last'; break; case 'three_fourth_last' : case 'three_fourths_last' : $class .= 'three_fourths last'; break; case 'one_fifth_last' : $class .= 'one_fifth last'; break; case 'two_fifth_last' : case 'two_fifths_last' : $class .= 'two_fifths last'; break; case 'three_fifth_last' : case 'three_fifths_last' : $class .= 'three_fifth last'; break; case 'four_fifth_last' : case 'four_fifths_last' : $class .= 'four_fifth last'; break; } // Is user adding additional classes? if ( isset( $atts['class'] ) ) { $class .= ' '.$atts['class']; } // Force wpautop in shortcode? (not relevant if columns not wrapped in [raw]) if ( isset( $atts['wpautop'] ) && trim( $atts['wpautop'] ) == 'true') { $content = wpautop( $content ); } // Return column $content = '
'.$content.'
'; return do_shortcode( $content ); } /** * Clear Row * * @since 1.0.0 */ function smpl_shortcode_clear() { return '
'; } /*-----------------------------------------------------------*/ /* Components /*-----------------------------------------------------------*/ /** * Button * * @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_button( $atts, $content = null ) { extract(shortcode_atts(array( 'link' => '', 'size' => 'medium', 'color' => '', 'class' => '', 'block' => 'false', 'icon_before' => '', 'target' => '_self', 'caption' => '', 'align' => 'right' ), $atts)); $button =''; $button .= '
'; $button .= ''; $button .= $content; if ($caption != '') { $button .= '
'.$caption.''; }; $button .= '
'; return $button; } /** * Info Boxes * * @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_cta( $atts, $content = null ) { $output = ''; $has_icon = ''; $default = array( 'style' => 'blue', // blue, green, grey, orange, purple, red, teal, magenta 'icon' => '' ); extract( shortcode_atts( $default, $atts ) ); // Classes $classes = sprintf( 'cta info-box-%s', $style ); // Add icon if( $icon ) { $classes .= ' info-box-has-icon'; $content = sprintf( '%s', $icon, do_shortcode($content) ); } $output = sprintf( '
%s
', $classes, do_shortcode($content) ); return $output; } /** * Callout Boxes (CTA) * * @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_callout( $atts, $content = null ) { extract( shortcode_atts( array( 'style' => 'white', 'title' => '', 'align' => 'center', 'centertitle' => '', 'width' => '' ), $atts ) ); if (!empty($width)) { // regex to check for percentage or px symbol $pattern = "/%|px/"; // if specified if (preg_match ($pattern, $width)) { $width = 'style="width:' . $width .';" '; // else, just add px by default } else { $width = 'style="width:' . $width .'px;" '; } // empty. defaults to css } else { $width = ''; } if (!empty($centertitle) && $centertitle == "true") { $centertitle = 'center'; } else { $centertitle = ''; } if (!empty($title)) { $st_callout = '
'; $st_callout .= '

'.esc_attr($title).'

'; } 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".''."\n".''."\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.'

    '; 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 = '
    '; return $video; } /*-----------------------------------------------------------------------------------*/ // Responsive Vimeo Videos // Usage: [vimeo responsive="true" id="6686768"] /*-----------------------------------------------------------------------------------*/ // 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) function smpl_shortcode_vimeo( $atts, $content = null ) { extract( shortcode_atts( array( 'id' => '6686768', 'responsive' => 'true', 'width' => '', 'height' => '', 'center' => 'false'),$atts)); 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 = '
    '; return $video; } /*-----------------------------------------------------------------------------------*/ // // Latest Posts // Shortcode Parameters: // /*-----------------------------------------------------------------------------------*/ // excerpt="true|false" ------ display the excerpt or tag break // length="50" ------ excerpt character length // thumbs="true|false" ------ display featured thumbnail // width="50" ------ featured thumbnail width // cols="2" ------ split the results into X number of columns (4 max) // height="50" ------ featured thumbnail height // num="6" ------ number of entries to display // cat="1,-2" ------ categories to include or exclude (-) // morelink="Read More..." ------ more link text // offset="0" ------ offset/skip X number of posts // type="page|post" ------ query type // parent="1" (page only) ------ page parent // orderby="date|customfield" ------ custom ordering // order="ASC|DESC" ------ sort order /*-----------------------------------------------------------------------------------*/ // Example: [latest excerpt="true" thumbs="true" width="50" height="50" num="5" cat="8,10,11"] /*-----------------------------------------------------------------------------------*/ function smpl_shortcode_latest($atts, $content = null) { extract(shortcode_atts(array( "offset" => '', "num" => '4', "cols" => '1', "thumbs" => 'false', "date" => 'false', "excerpt" => 'false', "length" => '50', "morelink" => '', "width" => '100', "height" => '100', "type" => 'post', "parent" => '', "cat" => '', "orderby" => 'date', "order" => 'ASC' ), $atts)); global $post; $do_not_duplicate[] = $post->ID; $args = array( 'post__not_in' => $do_not_duplicate, 'cat' => $cat, 'post_type' => $type, 'post_parent' => $parent, 'showposts' => $num, 'orderby' => $orderby, 'offset' => $offset, 'order' => $order ); // query $myposts = new WP_Query($args); // set some variables for quicker math processing $count = 1; $col_count = $cols; $num_of_posts = $myposts->post_count; $post_per_column = ceil($num_of_posts / $col_count); switch ($col_count) { case '4': $div = "one_fourth"; break; case '3': $div = "one_third"; break; case '2': $div = "one_half"; break; default: $div = "row"; break; } // container $result='
    '; // begin loop while($myposts->have_posts()) : $myposts->the_post(); // remove left margin from first column if ($count == 1) { $result.='
    '; } // math to determine interior/last columns switch ($col_count) { case '4': if ($count == $post_per_column * 3 + 1) { $result.='
    '; // $result.='BEGIN LAST'; } elseif ($count == $post_per_column + 1 || $count == $post_per_column * 2 + 1) { $result.='
    '; // $result.='BEGIN INNER'; } break; case '3': if ($count == $post_per_column * 2 + 1) { $result.='
    '; // $result.='BEGIN LAST'; } elseif ($count == $post_per_column + 1) { $result.='
    '; // $result.='BEGIN INNER'; } break; case '2': // get first item of last set if ($count == $post_per_column + 1) { $result.='
    '; // $result.='BEGIN LAST'; } break; default: $result.=''; break; } // item open $result.='
    '; // title if ($excerpt == 'true') { $result.='

    '.the_title("","",false).'

    '; } else { $result.=''; } // post date if ($date == 'false') { $result.='
    '.get_the_date().'
    '; # code... } // thumbnail if (has_post_thumbnail() && $thumbs == 'true') { if ( function_exists( 'st_timthumb' ) ) { $result.= ''.get_the_title().''; } else { $result .= get_the_post_thumbnail( $post->ID, 'thumbnail', array('class' => 'alignleft latest-img') ); } } // excerpt if ($excerpt == 'true') { // allowed tags in excerpts $allowed_tags = ',,,,,
    '; // close columns if open if ($count == $post_per_column || $count == $num_of_posts || $count % $post_per_column == 0) { $result.='
    '; } // rinse and repeat $count++; endwhile; wp_reset_postdata(); // container close $result.='
    '; return $result; } function smpl_excerpt($words = 40, $link_text = 'Continue reading this entry »', $allowed_tags = '', $container = 'p', $smileys = 'no' ) { global $post; if ( $allowed_tags == 'all' ) $allowed_tags = ',,,,,