'Flash',
'bounce' => 'Bounce',
'shake' => 'Shake',
'tada' => 'Tada',
'swing' => 'Swing',
'wobble' => 'Wobble',
'wiggle' => 'Wiggle',
'pulse' => 'Pulse',
'slideInUp' => 'Slide In Up',
'slideInLeft' => 'Slide In Left',
'slideInRight' => 'Slide In Right',
'slideInDown' => 'Slide In Down',
'flip' => 'Flip',
'flipInX' => 'Flip In X',
'flipInY' => 'Flip In Y',
'fadeIn' => 'Fade In',
'fadeInUp' => 'Fade In Up',
'fadeInDown' => 'Fade In Down',
'fadeInLeft' => 'Fade In Left',
'fadeInRight' => 'Fade In Right',
'fadeInUpBig' => 'Fade In Up Big',
'fadeInDownBig' => 'Fade In Down Big',
'fadeInLeftBig' => 'Fade In Left Big',
'fadeInRightBig' => 'Fade In Right Big',
'bounceIn' => 'Bounce In',
'bounceInDown' => 'Bounce In Down',
'bounceInUp' => 'Bounce In Up',
'bounceInLeft' => 'Bounce In Left',
'bounceInRight' => 'Bounce In Right',
'rotateIn' => 'Rotate In',
'rotateInDownLeft' => 'Rotate In Down Left',
'rotateInDownRight' => 'Rotate In Down Right',
'rotateInUpLeft' => 'Rotate In Up Left',
'rotateInUpRight' => 'Rotate In Up Right',
'lightSpeedIn' => 'LightSpeed In',
'hinge' => 'Hinge',
'rollIn' => 'Roll In'
));
}
endif;
/*
* HEX to RGB
*/
if( !function_exists('ut_hex_to_rgb') ) :
function ut_hex_to_rgb($hex) {
$hex = preg_replace("/#/", "", $hex);
$color = array();
if(strlen($hex) == 3) {
$color['r'] = hexdec(substr($hex, 0, 1) . $r);
$color['g'] = hexdec(substr($hex, 1, 1) . $g);
$color['b'] = hexdec(substr($hex, 2, 1) . $b);
}
else if(strlen($hex) == 6) {
$color['r'] = hexdec(substr($hex, 0, 2));
$color['g'] = hexdec(substr($hex, 2, 2));
$color['b'] = hexdec(substr($hex, 4, 2));
}
$color = implode(',', $color);
return $color;
}
endif;
/*
* Custom "get"_comments_popup_link
*/
if( !function_exists('ut_get_comments_popup_link') ) {
function ut_get_comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
global $wpcommentspopupfile, $wpcommentsjavascript;
$id = get_the_ID();
if ( false === $zero ) $zero = __( 'No Comments' , 'ut_shortcodes' );
if ( false === $one ) $one = __( '1 Comment' , 'ut_shortcodes' );
if ( false === $more ) $more = __( '% Comments' , 'ut_shortcodes' );
if ( false === $none ) $none = __( 'Comments Off' , 'ut_shortcodes' );
$number = get_comments_number( $id );
$str = '';
if ( 0 == $number && !comments_open() && !pings_open() ) {
$str = '' . $none . ' ';
return $str;
}
if ( post_password_required() ) {
$str = __('Enter your password to view comments.' , 'ut_shortcodes' );
return $str;
}
$str = ' 0 ) );
$str .= apply_filters( 'comments_popup_link_attributes', '' );
$str .= ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
$str .= ut_get_comments_number_str( $zero, $one, $more );
$str .= ' ';
return $str;
}
}
if( !function_exists('ut_get_comments_number_str') ) {
function ut_get_comments_number_str( $zero = false, $one = false, $more = false, $deprecated = '' ) {
if ( !empty( $deprecated ) )
_deprecated_argument( __FUNCTION__, '1.3' );
$number = get_comments_number();
if ( $number > 1 )
$output = str_replace('%', number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
elseif ( $number == 0 )
$output = ( false === $zero ) ? __('No Comments') : $zero;
else // must be one
$output = ( false === $one ) ? __('1 Comment') : $one;
return apply_filters('comments_number', $output, $number);
}
}
/*
* Fix Shortcodes
*/
if( !function_exists('ut_fix_shortcodes') ) {
function ut_fix_shortcodes($content){
$block = join("|",array( "ut_animate_image" , "ut_button" , "ut_icon" , "ut_alert" , "ut_one_sixth" , "ut_one_sixth_last" , "ut_one_fifth" , "ut_one_fifth_last" , "ut_one_fourth" , "ut_one_fourth_last" , "ut_one_third" , "ut_one_third_last" , "ut_one_half" , "ut_one_half_last" , "ut_two_thirds" ,
"ut_two_thirds_last" , "ut_three_fourth" , "ut_three_fourth_last" , "ut_probar" , "ut_highlight" , "ut_tabgroup" , "ut_tab" , "ut_togglegroup" , "ut_toggle" , "ut_rotate_words" , "ut_fw_section" , "ut_showcase" , "ut_service_box" , "ut_quote_rotator" ,
"ut_quote" , "ut_quote_rotator_alt" , "ut_quote_alt" , "ut_service_column" , "ut_service_column_vertical" , "ut_count_up" , "ut_parallax_quote" , "ut_social" , "ut_social_media", "ut_client_group" , "ut_client" , "ut_single_quote" ));
$rep = preg_replace("/(
)?\[($block)(\s[^\]]+)?\](<\/p>| )?/","[$2$3]",$content);
$rep = preg_replace("/(
)?\[\/($block)](<\/p>| )?/","[/$2]",$rep);
return $rep;
}
add_filter('the_content', 'ut_fix_shortcodes');
}
/*
* Button
*/
if( !function_exists('ut_create_button') ) {
function ut_create_button( $atts, $content = null ) {
extract( shortcode_atts( array (
'link' => '#',
'color' => '',
'class' => '',
'size' => 'small',
'target' => '_self',
'shape' => ''
), $atts));
$button = '';
$button .= '';
$button .= $content;
$button .= ' ';
return $button;
}
add_shortcode('ut_button', 'ut_create_button');
}
/*
* Icons
*/
if( !function_exists('ut_create_icon') ) {
function ut_create_icon($atts, $content = null) {
extract(shortcode_atts(array(
'icon' => 'fa-off',
'size' => 'fa-4',
'color' => '',
'bgcolor' => '#CCC',
'border' => 'none',
'spin' => '',
'rotate' => '',
'link' => '',
'target' => 'self',
'align' => 'alignnone',
'class' => ''
), $atts));
$finalicon = NULL;
$iconclass = NULL;
if( $border == 'none' ) {
/* default icon */
$classes = array('icon' , 'size' , 'spin', 'rotate', 'class');
$style = (!empty($color)) ? 'style="color:'.$color.'"' : '';
$span_open = '';
$span_close = ' ';
foreach($atts as $key => $att) {
if( !empty($att) && in_array($key, $classes) )
$iconclass .= $att.' ';
}
if(!empty($link)) {
$finalicon .= $span_open .' '. $span_close;
} else {
$finalicon .= $span_open .' '. $span_close;
}
} else {
/* stacked icon */
$classes = array('icon' , 'spin', 'rotate', 'class');
$style = (!empty($color)) ? 'style="color:'.$color.'"' : '';
foreach($atts as $key => $att) {
if( !empty($att) && in_array($key, $classes) )
$iconclass .= $att.' ';
}
/* start output */
$finalicon .= '';
if(!empty($link)) { $finalicon .= ''; }
$finalicon .= ' ';
$finalicon .= ' ';
if(!empty($link)) { $finalicon .= ' '; }
$finalicon .= ' ';
}
return $finalicon;
}
add_shortcode('ut_icon', 'ut_create_icon');
}
/*
* Alerts
*/
if( !function_exists('ut_create_alert') ) {
function ut_create_alert( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'color' => 'white',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '
' . do_shortcode($content) . '
';
}
add_shortcode('ut_alert', 'ut_create_alert');
}
/*
* Image Animation
*/
if( !function_exists('ut_animate_image') ) {
function ut_animate_image( $atts, $content = null ) {
extract(shortcode_atts(array(
'align' => 'left',
'class' => '',
'image' => '',
'alt' => '',
'margin_top' => '',
'margin_bottom' => '',
'effect' => 'fadeIn'
), $atts));
if( empty($image) ) {
return __( 'No Image Selected' , 'ut_shortcodes' );
}
$extrastyle = NULL;
if( !empty($margin_top) ) {
$extrastyle .= 'margin-top:'.$margin_top.'px; ';
}
if( !empty($margin_bottom) ) {
$extrastyle .= 'margin-bottom:'.$margin_bottom.'px; ';
}
$out = '';
$out .= '
';
$out .= '
';
return $out;
}
add_shortcode('ut_animate_image', 'ut_animate_image');
}
/*
* One Sixth Grid
*/
if( !function_exists('ut_one_sixth') ) {
function ut_one_sixth( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_sixth', 'ut_one_sixth');
}
if( !function_exists('ut_one_sixth_last') ) {
function ut_one_sixth_last( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_sixth_last', 'ut_one_sixth_last');
}
/*
* One Fifth Grid
*/
if( !function_exists('ut_one_fifth') ) {
function ut_one_fifth( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_fifth', 'ut_one_fifth');
}
if( !function_exists('ut_one_fifth_last') ) {
function ut_one_fifth_last( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_fifth_last', 'ut_one_fifth_last');
}
/*
* One Fourth Grid
*/
if( !function_exists('ut_one_fourth') ) {
function ut_one_fourth( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_fourth', 'ut_one_fourth');
}
if( !function_exists('ut_one_fourth_last') ) {
function ut_one_fourth_last( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_fourth_last', 'ut_one_fourth_last');
}
/*
* One Third Grid
*/
if( !function_exists('ut_one_third') ) {
function ut_one_third( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_third', 'ut_one_third');
}
if( !function_exists('ut_one_third_last') ) {
function ut_one_third_last( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_third_last', 'ut_one_third_last');
}
/*
* One Half Grid
*/
if( !function_exists('ut_one_half') ) {
function ut_one_half( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_half', 'ut_one_half');
}
if( !function_exists('ut_one_half_last') ) {
function ut_one_half_last( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_one_half_last', 'ut_one_half_last');
}
/*
* Two Thirds Grid
*/
if( !function_exists('ut_two_thirds') ) {
function ut_two_thirds( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_two_thirds', 'ut_two_thirds');
}
if( !function_exists('ut_two_thirds_last') ) {
function ut_two_thirds_last( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_two_thirds_last', 'ut_two_thirds_last');
}
/*
* Three Fourth Grid
*/
if( !function_exists('ut_three_fourths') ) {
function ut_three_fourths( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_three_fourths', 'ut_three_fourths');
}
if( !function_exists('ut_three_fourths_last') ) {
function ut_three_fourths_last( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'effect' => ''
), $atts));
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
return '' . do_shortcode($content) . '
';
}
add_shortcode('ut_three_fourths_last', 'ut_three_fourths_last');
}
/*
* Progress Bar
*/
if( !function_exists('ut_probar') ) {
function ut_probar( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => '',
'color' => '',
'info' => '',
'width' => '50'
), $atts));
// strip % if user has entered it
$width = str_replace('%' , '' , $width);
// optional color
$color = !empty($color) ? 'style="background:'.$color.';"' : '';
$skillbar = '';
if( !empty( $info ) ) {
$skillbar .= '
' . $info . ' ';
}
$skillbar .= '
';
$skillbar .= '
';
$skillbar .= ''.$width.'% ';
$skillbar .= '
';
$skillbar .= '
';
$skillbar .= '
';
return $skillbar;
}
add_shortcode('ut_probar', 'ut_probar');
}
/*
* Highlights
*/
if( !function_exists('ut_highlight') ) {
function ut_highlight($atts, $content = null) {
extract(shortcode_atts(array(
'class' => '',
'color' => '',
'bgcolor' => ''
), $atts));
$extraStyle = 'style="';
if( !empty($color) ) {
$extraStyle .= 'color: ' . $color . ' ;';
}
if( !empty($bgcolor) ) {
$extraStyle .= 'background: ' . $bgcolor . ' ;';
}
$extraStyle .= '"';
return ''.do_shortcode($content).' ';
}
add_shortcode('ut_highlight', 'ut_highlight');
}
/*
* Tabs
*/
if( !function_exists('ut_tabgroup') ) {
function ut_tabgroup( $atts, $content ){
extract(shortcode_atts(array(
'width' => '',
'last' => 'false',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half' );
$last = $last == 'true' ? 'ut-column-last' : '';
$return = '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
$GLOBALS['tab_count'] = 0;
$GLOBALS['tabs'] = array();
do_shortcode( $content );
if( is_array( $GLOBALS['tabs'] ) ){
$tabcount = 1;
foreach( $GLOBALS['tabs'] as $tab ){
$active = ($tabcount == 1) ? 'class="active"' : '';
$tabs[] = ''.$tab['title'].' ';
$active = ($tabcount == 1) ? 'active' : '';
$panes[] = ''.do_shortcode($tab['content']).'
';
$tabcount++;
}
if( !empty($width) || !empty($class) ) {
$return .= '';
}
$return .= "\n".'
'.implode( "\n", $tabs ).' '."\n".'
'.implode( "\n", $panes ).'
'."\n";
if( !empty($width) ) {
$return .= '
';
}
}
return $return;
}
add_shortcode( 'ut_tabgroup', 'ut_tabgroup' );
}
if( !function_exists('ut_tab') ) {
function ut_tab( $atts, $content ){
extract(shortcode_atts(array(
'title' => '%d',
'id' => '%d',
'class' => ''
), $atts));
$x = $GLOBALS['tab_count'];
$GLOBALS['tabs'][$x] = array(
'title' => sprintf( $title, $GLOBALS['tab_count'] ),
'content' => $content,
'id' => $id,
'class' => $class );
$GLOBALS['tab_count']++;
}
add_shortcode( 'ut_tab', 'ut_tab' );
}
/*
* Quote Rotator
*/
if( !function_exists('ut_quote_rotator') ) {
function ut_quote_rotator( $atts, $content ){
extract(shortcode_atts(array(
'width' => '',
'last' => 'false',
'speed' => '9000',
'autoplay' => 'on',
'randomize' => 'off',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half',
'fullwdith' => '');
$last = $last == 'true' ? 'ut-column-last' : '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
/* set unique ID for this rotator */
$id = uniqid("utquote_");
/* autoplay */
$autoplay = ($autoplay == 'off') ? 'slideshow: false,' : NULL;
/* randomize */
$randomize = ($randomize == 'on') ? 'randomize: true,' : NULL;
$script = '
';
$quote_rotator = '';
$quote_rotator .= '
';
$quote_rotator .= '
';
$quote_rotator .= do_shortcode( $content );
$quote_rotator .= ' ';
$quote_rotator .= '
';
$quote_rotator .= '
';
$quote_rotator .= '
';
$quote_rotator .= do_shortcode( $content );
$quote_rotator .= ' ';
$quote_rotator .= '
';
$quote_rotator .= '
';
return $script . $quote_rotator;
}
add_shortcode( 'ut_quote_rotator', 'ut_quote_rotator' );
}
if( !function_exists('ut_quote') ) {
function ut_quote( $atts, $content ){
extract(shortcode_atts(array(
'author' => '',
'avatar' => ''
), $atts));
if( !empty($avatar) ) {
$avatar = ut_resize( $avatar , '200' , '200', true , true , true );
}
$quote = '';
if( !empty($avatar) ) {
$quote .= ' ';
}
if( !empty($content) ) {
$quote .= '';
}
if( !empty($author) ) {
$quote .= '' . $author . ' ';
}
$quote .= ' ';
return $quote;
}
add_shortcode( 'ut_quote', 'ut_quote' );
}
/*
* Quote Rotator Alt ( without Avatar )
*/
if( !function_exists('ut_quote_rotator_alt') ) {
function ut_quote_rotator_alt( $atts, $content ){
extract(shortcode_atts(array(
'width' => '',
'last' => 'false',
'speed' => '9000',
'autoplay' => 'on',
'randomize' => 'off',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half',
'fullwdith' => '');
$last = $last == 'true' ? 'ut-column-last' : '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
/* autoplay */
$autoplay = ($autoplay == 'off') ? 'slideshow: false,' : NULL;
/* randomize */
$randomize = ($randomize == 'on') ? 'randomize: true,' : NULL;
/* set unique ID for this rotator */
$id = uniqid("utquote_");
$script = '
';
$quote_rotator = '';
$quote_rotator .= '
';
$quote_rotator .= '
';
$quote_rotator .= do_shortcode( $content );
$quote_rotator .= ' ';
$quote_rotator .= '
';
$quote_rotator .= '
';
return $script . $quote_rotator;
}
add_shortcode( 'ut_quote_rotator_alt', 'ut_quote_rotator_alt' );
}
if( !function_exists('ut_quote_alt') ) {
function ut_quote_alt( $atts, $content ){
extract(shortcode_atts(array(
'author' => ''
), $atts));
$quote = '' . $author . ' ';
return $quote;
}
add_shortcode( 'ut_quote_alt', 'ut_quote_alt' );
}
/*
* Social Media List
*/
$GLOBALS['ut_social_total_count'] = NULL;
$GLOBALS['ut_social_count'] = NULL;
if( !function_exists('ut_social_media') ) {
function ut_social_media( $atts, $content ){
extract(shortcode_atts(array(
'class' => ''
), $atts));
global $ut_social_total_count, $ut_social_count;
$ut_social_total_count = substr_count($content, '[/ut_social]');
$ut_social_count = 0;
$social = '';
$social .= do_shortcode( $content );
$social .= ' ';
return $social;
}
add_shortcode( 'ut_social_media', 'ut_social_media' );
}
if( !function_exists('ut_social') ) {
function ut_social( $atts, $content ){
extract(shortcode_atts(array(
'title' => '',
'url' => '#',
'icon' => 'fa-facebook',
'target' => '_blank',
'avatar' => '',
'class' => ''
), $atts));
$grid = array( 1 => '100',
2 => '25',
3 => '33',
4 => '25',
5 => '20' );
global $ut_social_total_count, $ut_social_count;
$prefix = NULL;
$suffix = NULL;
//fallback if there is no global value
$ut_social_total_count = empty($ut_social_total_count) ? 5 : $ut_social_total_count;
// special case if we only have 2 items
if( $ut_social_total_count == 2 && $ut_social_count == 0 ) {
$prefix = "prefix-25 tablet-prefix-25";
}
if( $ut_social_total_count == 2 && $ut_social_count == 1 ) {
$suffix = "suffix-25 tablet-suffix-25";
}
$grid_items = ( $ut_social_total_count >= 5 ) ? 5 : $ut_social_total_count;
$profile = '';
$profile .= '';
$profile .= ' ';
if( !empty($title) ) {
$profile .= '' . $title . ' ';
}
if( !empty($content) ) {
$profile .= '' . do_shortcode( $content ) . ' ';
}
$profile .= ' ';
$profile .= ' ';
/* global counter */
$ut_social_count++;
/* if counter has reached the maximum of 5 per row , decrease the total counter */
if( $ut_social_count == 5 && $ut_social_total_count > 5) {
$ut_social_total_count = $ut_social_total_count - $ut_social_count;
$ut_social_count = 1;
}
return $profile;
}
add_shortcode( 'ut_social', 'ut_social' );
}
/*
* Client Group
*/
$GLOBALS['ut_client_total_count'] = NULL;
$GLOBALS['ut_client_count'] = NULL;
$GLOBALS['ut_client_carousel'] = FALSE;
if( !function_exists('ut_client_group') ) {
function ut_client_group( $atts, $content ){
extract(shortcode_atts(array(
'class' => '',
'carousel' => 'off'
), $atts));
global $ut_client_total_count, $ut_client_count, $ut_client_carousel;
$ut_client_total_count = substr_count($content, '[/ut_client]');
$ut_client_count = 0;
$social = NULL;
$id = uniqid("utcc_");
if( !empty( $carousel ) && $carousel == 'on' ) {
$ut_client_carousel = TRUE;
$social .= '
';
$social .= '';
$social .= do_shortcode( $content );
$social .= ' ';
} else {
$social .= '';
$social .= do_shortcode( $content );
$social .= '
';
}
return $social;
$ut_client_carousel = FALSE;
}
add_shortcode( 'ut_client_group', 'ut_client_group' );
}
if( !function_exists('ut_client') ) {
function ut_client( $atts, $content ){
extract(shortcode_atts(array(
'name' => '',
'logo' => '',
'url' => '',
'target' => '_blank',
'class' => ''
), $atts));
$grid = array( 1 => '100',
2 => '50',
3 => '33',
4 => '25',
5 => '20' );
global $ut_client_total_count, $ut_client_count, $ut_client_carousel;
if( $ut_client_carousel ) {
$client = '';
if( !empty($url) ) {
$client .= '';
}
$client .= ' ';
if( !empty($url) ) {
$client .= ' ';
}
$client .= ' ';
} else {
//fallback if there is no global value
$ut_client_total_count = empty($ut_client_total_count) ? 5 : $ut_client_total_count;
$grid_items = ( $ut_client_total_count >= 5 ) ? 5 : $ut_client_total_count;
$client = '';
/* global counter */
$ut_client_count++;
/* if counter has reached the maximum of 5 per row , decrease the total counter */
if( $ut_client_count == 5 && $ut_client_total_count > 5) {
$ut_client_total_count = $ut_client_total_count - $ut_client_count;
$ut_client_count = 0;
}
}
return $client;
}
add_shortcode( 'ut_client', 'ut_client' );
}
/*
* Toggles
*/
if( !function_exists('ut_togglegroup') ) {
$togglegroupcount = 0;
function ut_togglegroup( $atts, $content ){
global $togglegroupcount;
extract(shortcode_atts(array(
'width' => '',
'last' => 'false',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half');
$last = $last == 'true' ? 'ut-column-last' : '';
$return = '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
$togglegroupcount++;
if( !empty($width) || !empty($class) ) {
$return .= '';
}
$return .= '
'.do_shortcode($content).'
';
if( !empty($width) || !empty($class) ) {
$return .= '
';
}
return $return;
}
add_shortcode( 'ut_togglegroup', 'ut_togglegroup' );
}
if( !function_exists('ut_toggle') ) {
$togglecount = 0;
function ut_toggle( $atts, $content = null ) {
global $togglecount , $togglegroupcount;
extract(shortcode_atts(array(
'title' => '',
'state' => 'closed',
'class' => ''
), $atts));
$output = '';
$hstate = ($state == 'closed') ? 'collapsed' : '';
$state = ($state == 'closed') ? 'collapse' : 'collapse in';
$active = ($state == 'collapse') ? '' : 'active';
$output .= '';
$output .= '';
$output .= '
';
$output .= do_shortcode($content);
$output .= '
';
$output .= '
';
$togglecount++;
return $output;
}
add_shortcode('ut_toggle', 'ut_toggle');
}
/*
* Blockquotes
*/
if( !function_exists('ut_blockquote_left') ) {
function ut_blockquote_left($atts, $content = null) {
extract(shortcode_atts(array(
'class' => ''
), $atts));
return ''.do_shortcode($content).'
';
}
add_shortcode('ut_blockquote_left', 'ut_blockquote_left');
}
if( !function_exists('ut_blockquote_right') ) {
function ut_blockquote_right($atts, $content = null) {
extract(shortcode_atts(array(
'class' => ''
), $atts));
return ''.do_shortcode($content).'
';
}
add_shortcode('ut_blockquote_right', 'ut_blockquote_right');
}
/*
* Title Divider
*/
if( !function_exists('ut_title_divider') ) {
function ut_title_divider($atts, $content = null) {
extract(shortcode_atts(array(
'margin_top' => '',
'class' => ''
), $atts));
$style = ( !empty($margin_top) ) ? 'style="margin-top:' . $margin_top . 'px;"' : '';
return ''.do_shortcode($content).' ';
}
add_shortcode('ut_title_divider', 'ut_title_divider');
}
/*
* Word Rotator
*/
$GLOBALS['ut_wr_count'] = 1;
if( !function_exists('ut_word_rotator') ) {
function ut_word_rotator($atts, $content = null) {
extract(shortcode_atts(array(
'timer' => 2000 ,
'class' => ''
), $atts));
$x = $GLOBALS['ut_wr_count'];
/* split up words */
$words = explode( ',' , $content );
/* final rotator word variable*/
$rotator_words = '';
/* loop through word array and concatinate final string*/
foreach( $words as $key => $word ) {
$rotator_words .= '\'' . trim($word) . '\',';
}
/* cut of last comma */
$rotator_words = substr($rotator_words,0,-1);
/* needed javascript */
$script = '
';
$span = '' . $words[0] . ' ';
$GLOBALS['ut_wr_count']++;
return $script . $span;
}
add_shortcode('ut_rotate_words', 'ut_word_rotator');
}
/*
* Service Column
*/
if( !function_exists('ut_service_column') ) {
function ut_service_column($atts, $content = null) {
extract(shortcode_atts(array(
'icon' => '',
'align' => '',
'shape' => 'normal',
'color' => '#FFF',
'background' => '',
'headline' => '',
'width' => '',
'margin_bottom' => '',
'effect' => '',
'last' => 'false',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half',
'full' => '');
$last = ( $last == 'true' ) ? 'ut-column-last' : '';
$talign = ( $align == 'right' ) ? 'style="text-align:right;"' : '';
$align = ( $align == 'right' ) ? 'ut-si-right' : '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : 'clearfix';
/* margin bottom*/
$margin_bottom = !empty($margin_bottom) ? 'style="margin-bottom:'.$margin_bottom.'px"' : '';
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
$column = '';
if(!empty($icon) && $shape == 'round') {
$column .= '
';
$column .= ' ';
$column .= ' ';
} elseif( !empty($icon) ) {
$column .= '
';
$column .= ' ';
$column .= ' ';
}
$column .= '
';
if( !empty($headline) ) {
$column .= '
' . do_shortcode($headline) . ' ';
}
$column .= '
' . do_shortcode($content) . '
';
$column .= '
';
$column .= '
';
return $column;
}
add_shortcode('ut_service_column', 'ut_service_column');
}
/*
* Service Column Vertical
*/
if( !function_exists('ut_service_column_vertical') ) {
function ut_service_column_vertical($atts, $content = null) {
extract(shortcode_atts(array(
'icon' => '',
'shape' => 'normal',
'color' => '#FFF',
'background' => '',
'headline' => '',
'width' => 'third',
'margin_bottom' => '',
'effect' => '',
'last' => 'false',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half',
'full' => '');
$last = $last == 'true' ? 'ut-column-last' : '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : 'clearfix';
/* margin bottom*/
$margin_bottom = !empty($margin_bottom) ? 'style="margin-bottom:'.$margin_bottom.'px"' : '';
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
$column = '';
if(!empty($icon) && $shape == 'round') {
$column .= '
';
$column .= ' ';
$column .= ' ';
} elseif( !empty($icon) ) {
$column .= '
';
$column .= ' ';
$column .= ' ';
}
$column .= '
';
if( !empty($headline) ) {
$column .= '
' . $headline . ' ';
}
$column .= '
' . do_shortcode($content) . '
';
$column .= '
';
$column .= '
';
return $column;
}
add_shortcode('ut_service_column_vertical', 'ut_service_column_vertical');
}
/*
* Icon Box
*/
if( !function_exists('ut_service_box') ) {
function ut_service_box($atts, $content = null) {
extract(shortcode_atts(array(
'icon' => '',
'color' => '#FFF',
'background' => '',
'opacity' => '0.8',
'headline' => '',
'width' => 'third',
'effect' => '',
'last' => 'false',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half');
$last = $last == 'true' ? 'ut-column-last' : '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
$arrow = !empty($background) ? 'style="border-left: 10px solid rgba('. ut_hex_to_rgb($background) .',' . $opacity . ');"' : '';
$background = !empty($background) ? 'background: rgba('. ut_hex_to_rgb($background) .',' . $opacity . ');' : '';
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
$box = '';
$box .= '
';
$box .= '
';
$box .= '
';
$box .= '
';
$box .= '
';
$box .= '
' . $headline . ' ';
$box .= '
' . do_shortcode($content) . '
';
$box .= '
';
$box .= '
';
return $box;
}
add_shortcode('ut_service_box', 'ut_service_box');
}
/*
* Service Box
*/
if( !function_exists('ut_service_icon_box') ) {
function ut_service_icon_box($atts, $content = null) {
extract(shortcode_atts(array(
'icon' => '',
'color' => '#CCC',
'hovercolor' => '#3CC6AB',
'url' => '#',
'link' => '#',
'headline' => '',
'width' => 'third',
'effect' => '',
'last' => '',
'target' => '_self',
'class' => ''
), $atts));
if( empty($url) ) {
$url = $link;
}
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half');
$last = $last == 'true' ? 'ut-column-last' : '';
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
$id = uniqid("utbx_");
$box = '';
$box .= '';
$box .= '
';
$box .= '
';
if( !empty( $headline ) ) {
$box .= '
' . $headline . ' ';
}
$box .= '
' . do_shortcode($content) . '
';
$box .= '
';
$box .= '
';
return $box;
}
add_shortcode('ut_service_icon_box', 'ut_service_icon_box');
}
/*
* Count Up
*/
if( !function_exists('ut_count_up') ) {
function ut_count_up($atts, $content = null) {
extract(shortcode_atts(array(
'color' => '',
'desccolor' => '',
'to' => '1250',
'background' => '',
'opacity' => '0.8',
'width' => '',
'icon' => '',
'last' => 'false',
'class' => ''
), $atts));
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half');
$last = $last == 'true' ? 'ut-column-last' : '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
$background = !empty($background) ? 'style="background: rgba('. ut_hex_to_rgb($background) .',' . $opacity . ');"' : '';
$color = !empty($color) ? 'style="color: ' . $color . '"' : '';
$desccolor = !empty($desccolor) ? 'style="color: ' . $desccolor . '"' : '';
$box = '';
$box .= '
';
if( !empty($icon) ) {
$box .= ' ';
}
$box .= '' . $to . ' ';
$box .= '
' . do_shortcode($content) . ' ';
$box .= '';
$box .= '
';
return $box;
}
add_shortcode('ut_count_up', 'ut_count_up');
}
/*
* Fancy Link
*/
if( !function_exists('ut_fancy_link') ) {
function ut_fancy_link($atts, $content = null) {
extract(shortcode_atts(array(
'url' => '#',
'class' => ''
), $atts));
$link = '' . do_shortcode($content) . ' ';
return $link;
}
add_shortcode('ut_fancy_link', 'ut_fancy_link');
}
/*
* Dropcaps
*/
if( !function_exists('ut_dropcap') ) {
function ut_dropcap($atts, $content = null) {
extract(shortcode_atts(array(
'class' => '',
'style' => 'one'
), $atts));
return ''.do_shortcode($content).' ';
}
add_shortcode('ut_dropcap', 'ut_dropcap');
}
/*
* Vimeo
*/
if( !function_exists('ut_video_vimeo') ) {
function ut_video_vimeo($atts, $content = null) {
extract(shortcode_atts(array(
'url' => '',
'id' => '',
'class' => ''
), $atts));
if( !empty($url) && (int)$url ) {
$id = $url;
}
if( !(int)$id ) {
return __( 'Please insert only a valid video ID' , 'ut_shortcodes' );
} else {
return str_replace('&','&','
');
}
}
add_shortcode('ut_video_vimeo', 'ut_video_vimeo');
}
/*
* Youtube
*/
if( !function_exists('ut_video_youtube') ) {
function ut_video_youtube($atts, $content = null) {
extract(shortcode_atts(array(
'url' => '',
'id' => '',
'class' => ''
), $atts));
if( !empty($url) ) {
$id = $url;
}
return str_replace('&','&','VIDEO
');
}
add_shortcode('ut_video_youtube', 'ut_video_youtube');
}
/*
* clear
*/
if( !function_exists('ut_clear') ) {
function ut_clear() {
return '
';
}
add_shortcode('ut_clear', 'ut_clear');
}
/*
* Parallax Quote
*/
if( !function_exists( 'ut_parallax_quote' ) ) {
function ut_parallax_quote($atts, $content = null) {
extract(shortcode_atts(array(
'cite' => '',
'class' => ''
), $atts));
$blockquote = '
';
$blockquote .= do_shortcode($content);
$blockquote .= ' ';
if( !empty($cite) ) {
$blockquote .= '' . $cite . ' ';
}
$blockquote.= '';
return $blockquote;
}
add_shortcode('ut_parallax_quote', 'ut_parallax_quote');
}
/*
* Tweet Rotator , only available if ut witter plugin has been installed
*/
if( ut_is_plugin_active('ut-twitter/ut.twitter.php') ) {
if( !function_exists( 'ut_twitter_rotator' ) ) {
function ut_twitter_rotator($atts, $content = null) {
extract(shortcode_atts(array(
'avatar' => 'off',
'width' => '',
'count' => '3',
'speed' => '9000',
'class' => '',
'last' => 'false',
'' => ''
), $atts));
/* grid settings */
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half',
'fullwdith' => '');
$last = $last == 'true' ? 'ut-column-last' : '';
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
$twitter_options = ( is_array( get_option('ut_twitter_options') ) ) ? get_option('ut_twitter_options') : array();
/** Set access tokens here - see: https://dev.twitter.com/apps/ **/
$settings = array(
'oauth_access_token' => $twitter_options['oauth_access_token'],
'oauth_access_token_secret' => $twitter_options['oauth_access_token_secret'],
'consumer_key' => $twitter_options['consumer_key'],
'consumer_secret' => $twitter_options['consumer_secret']
);
if( empty($twitter_options['oauth_access_token']) || empty($twitter_options['oauth_access_token_secret']) || empty($twitter_options['consumer_key']) || empty($twitter_options['consumer_secret']) ) {
return '' . __( 'Please make sure you have entered all necessary Twitter API Keys under Dashboard -> Settings -> Twitter' , 'ut_shortcodes') . '
';
} else {
/* config */
$url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
$getfield = '?count='.$count;
$requestMethod = 'GET';
$twitter = new TwitterAPIExchange($settings);
$tweets = $twitter->setGetfield($getfield)->buildOauth($url, $requestMethod)->performRequest();
$tweets = json_decode( $tweets );
/* create twitter feed option */
if( !get_option('ut_twitter_feed') ) {
add_option('ut_twitter_feed');
}
/* update feeds */
if( !empty( $tweets ) && !isset( $tweets->errors[0]->code ) ) {
update_option('ut_twitter_feed' , $tweets);
}
/* we have an error - let's use the cached feeds */
if( empty( $tweets ) || isset( $tweets->errors[0]->code ) ) {
$tweets = get_option( 'ut_twitter_feed' );
}
if( empty($tweets) ) {
return ''.__('An Error has occured, no Twitter Feeds are available','ut_shortcodes').'
';
} else {
/* set unique ID for this rotator */
$id = uniqid("ut_tweet_");
/* output for slider without avatar */
if( $avatar == 'off' ) {
$script = '
';
$quote_rotator = '';
return $script . $quote_rotator;
}
/* output for slider with avatar */
if( $avatar == 'on' ) {
$script = '
';
$quote_rotator = '';
return $script . $quote_rotator;
}
}
}
}
add_shortcode('ut_twitter_rotator', 'ut_twitter_rotator');
}
}
/*
* List Icons ( Helper Shortcode )
*/
if( !function_exists('ut_list_icons') ) {
function ut_list_icons($content = null) {
$output = '';
$counter = 1;
foreach( ut_recognized_icons() as $icon ) {
$last = '';
$clear = '';
if( $counter == 5 ) { $last = 'ut-column-last'; $clear = '
'; }
$output .= '
' . $clear;
if( $counter == 5 ) { $counter = 1; } else { $counter++; }
}
$output .= '
';
return $output;
}
add_shortcode('ut_list_icons', 'ut_list_icons');
}
/*
* Blog
*/
if( !function_exists('ut_create_blog') ) {
function ut_create_blog( $atts, $content = null ) {
extract(shortcode_atts(array(
'numberposts' => '3',
'excerpt' => '',
'cat' => '',
'category_name' => '',
'class' => '',
'buttontext' => __('Read More' , 'ut_shortcodes'),
'order' => 'DESC'
), $atts));
$args = array(
'post_type' => 'post',
'cat' => $cat,
'category_name' => $category_name,
'posts_per_page' => $numberposts,
);
/* blog output */
$blog = '';
/* initiate query */
$blog_query = new WP_Query( $args );
/* start loop */
if ($blog_query->have_posts() ) : while ($blog_query->have_posts()) : $blog_query->the_post();
/* post format */
$post_format = get_post_format();
/* start single blog entry */
$blog .= '
';
/* entry header ( ho headline for quotes ) */
if( $post_format != 'quote' ) {
$blog .= '';
}
/* entry meta */
$blog .= '';
$blog .= ' ' . __("Sticky Post", "ut_shortcodes") . ' ';
//$blog .= ' ' . __("By", "ut_shortcodes") . ' ' . get_author_posts_link() . ' ';
$blog .= ' ' . __("On", "ut_shortcodes") . ' ' . get_the_time( get_option("date_format") ) . ' ';
if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) :
$blog .= '';
endif;
$blog .= '
';
/* post thumbnail */
if ( has_post_thumbnail() && ! post_password_required() ) {
$postthumbnail = wp_get_attachment_url( get_post_thumbnail_id( $blog_query->post->ID ) );
$blog .= '';
}
/* post format gallery */
if( $post_format == 'gallery' && function_exists("ut_flex_slider") ) {
$blog .= ut_flex_slider( $blog_query->post->ID , true );
if( !empty($excerpt) && (int)$excerpt ) {
$the_content = ut_get_excerpt_by_id( $blog_query->post->ID , $excerpt );
} else {
/* default content without gallery shortcode */
$the_content = get_the_content( '' . __( 'Read more', 'ut_shortcodes' ) . ' ' );
$the_content = preg_replace( '/(.?)\[(gallery)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s', '$1$6', $the_content );
$the_content = apply_filters( 'the_content' , $the_content );
}
} elseif ( $post_format == 'gallery' && !function_exists("ut_flex_slider") ) {
/* default content with wordPress gallery shortcode */
if( !empty($excerpt) && (int)$excerpt ) {
$the_content = ut_get_excerpt_by_id( $blog_query->post->ID , $excerpt );
} else {
$the_content = get_the_content( '' . __( 'Read more', 'ut_shortcodes' ) . ' ' );
$the_content = apply_filters( 'the_content' , $the_content );
}
} else {
/* content for all other post formats */
if( !empty($excerpt) && (int)$excerpt ) {
$the_content = ut_get_excerpt_by_id( $blog_query->post->ID , $excerpt );
} else {
$the_content = get_the_content( '' . __( 'Read more', 'ut_shortcodes' ) . ' ' );
$the_content = apply_filters( 'the_content' , $the_content );
}
}
/* post content */
$blog .= '';
/* add content which has been defined above */
$blog .= $the_content;
$blog .= '
';
/* end single blog entry */
$blog .= ' ';
/* loop finished */
endwhile; endif;
/* Restore original Post Data */
wp_reset_postdata();
$blog .= '
';
/* create link to blog */
$blog_id = get_option('page_for_posts');
$blog .= '
';
$blog .= '
';
return $blog;
}
add_shortcode('ut_blog', 'ut_create_blog');
}
/*
* Single Testimonial
*/
if( !function_exists('ut_single_quote') ) {
function ut_single_quote( $atts, $content = null ) {
extract(shortcode_atts(array(
'author' => '',
'company' => '',
'avatar' => '',
'title' => '',
'width' => '',
'date' => '',
'rating' => '',
'last' => 'false',
'margin_bottom' => '',
'class' => '',
'effect' => ''
), $atts));
/* width */
$grid = array( 'third' => 'ut-one-third',
'fourth' => 'ut-one-fourth',
'half' => 'ut-one-half' );
$last = $last == 'true' ? 'ut-column-last' : '';
/* ratings */
$ratings = array(
'one' => ' ',
'two' => ' ',
'three' => ' ',
'four' => ' ',
'five' => ' '
);
/* fallback */
$gridwidth = !empty($grid[$width]) ? $grid[$width] : '';
/* animation effect */
$dataeffect = $animated = NULL;
if( !empty( $effect ) ) {
$dataeffect = 'data-effect="'.$effect.'"';
$animated = 'ut-animate-element animated';
}
if( !empty($margin_bottom) ) {
$margin_bottom = 'style="margin-bottom:'.$margin_bottom.'px;"';
}
$testimonial = '';
if( !empty($avatar) ) {
$avatar = ut_resize( $avatar , '80' , '80', true , true , true );
$testimonial .= '
';
}
$testimonial .= '
';
if( !empty($title) || !empty($date) ) {
$testimonial .= '';
}
$testimonial .= '
' . do_shortcode($content) . '
';
if( !empty($rating) && isset($ratings[$rating]) ) {
$testimonial .= '
' . $ratings[$rating] . ' ';
}
if( !empty($author) ) {
$testimonial .= '
' . $author . ' ';
}
if( !empty($company) ) {
$testimonial .= '
'.$company.' ';
}
$testimonial .= '
';
$testimonial .= '
';
return $testimonial;
}
add_shortcode('ut_single_quote', 'ut_single_quote');
}
/*
* Gets the excerpt of a specific post ID or object
* @param - $post - object/int - the ID or object of the post to get the excerpt of
* @param - $length - int - the length of the excerpt in words
* @param - $tags - string - the allowed HTML tags. These will not be stripped out
*/
if ( !function_exists( 'ut_get_excerpt_by_id' ) ) {
function ut_get_excerpt_by_id($post, $length = 10, $tags = '') {
if( $post ) {
$post = get_post($post);
} elseif(!is_object($post)) {
return false;
}
if( has_excerpt($post->ID) ) {
$the_excerpt = $post->post_excerpt;
return apply_filters('the_content', $the_excerpt);
} else {
$the_excerpt = $post->post_content;
}
$the_excerpt = strip_shortcodes(strip_tags($the_excerpt), $tags);
$the_excerpt = preg_split('/\s+/', $the_excerpt, $length + 1);
$excerpt_waste = array_pop($the_excerpt);
$the_excerpt = implode(" ",$the_excerpt);
if( isset($the_excerpt) && !empty($the_excerpt) ) {
$the_excerpt = ''.$the_excerpt.'
';
$the_excerpt .= ''.__('Read More' , 'ut_shortcodes').'
';
} else {
$the_excerpt = ''.__('Read More' , 'ut_shortcodes').'
';
}
return $the_excerpt;
}
}
/*
* Helper Shortcode : Displays available atrributes for a shortcode
*/
if( !function_exists('ut_show_atts') ) {
function ut_show_atts( $atts, $content = null ) {
extract(shortcode_atts(array(
'shortcode' => '',
), $atts));
include( UT_SHORTCODES_DIR . '/admin/ut.sc.definitions.php');
if( empty($shortcode) ) {
return false;
}
global $ut_shortcodes;
$return = NULL;
if( !empty($ut_shortcodes[$shortcode]['attr']) && is_array($ut_shortcodes[$shortcode]['attr']) ) {
$return = '';
$return .= '';
$return .= 'Attribute ';
$return .= 'Values ';
$return .= ' ';
foreach( $ut_shortcodes[$shortcode]['attr'] as $attr => $values ) {
$return .= ' ';
$return .= '' . $attr . ' ';
/* possible attribute values */
if( !empty($values['values']) ) {
$return .= '' . __('value :' , 'ut_shortcodes') . implode(' or ' , $values['values']) . ' ';
}
/* hex color */
if( isset( $values['type'] ) && $values['type'] == 'colorpicker' ) {
$return .= '' . __('value : color hex' , 'ut_shortcodes') . ' ';
}
/* font awesome icon */
if( isset( $values['type'] ) && $values['type'] == 'icon' ) {
$return .= '' . __('value : iconname' , 'ut_shortcodes') . ' ' . __('list of icons names' , 'ut_shortcodes') . ' ';
}
/* class info */
if( $attr == 'class') {
$return .= '' . __('optional CSS class or classes' , 'ut_shortcodes') . ' ';
}
if( isset( $values['type'] ) && $values['type'] == 'input' && $attr != 'class' ) {
$return .= '' . __('value: custom value' , 'ut_shortcodes') . ' ';
}
/* available effects */
if( isset( $values['type'] ) && $values['type'] == 'effect' ) {
$return .= '' . __('value : effectname' , 'ut_shortcodes') . ' ' . __('list of effect names' , 'ut_shortcodes') . ' ';
}
$return .= ' ';
}
$return .= '
';
}
return $return;
}
add_shortcode('ut_show_atts', 'ut_show_atts');
}
?>