'', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one", "first" ); return $output; } function thrive_price_one_half( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_half", "first" ); return $output; } function thrive_price_one_half_last( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_half", "last" ); return $output; } function thrive_price_one_third( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_third", "normal" ); return $output; } function thrive_price_one_third_first( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_third", "first" ); return $output; } function thrive_price_one_third_last( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_third", "last" ); return $output; } function thrive_price_one_fourth( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_fourth", "normal" ); return $output; } function thrive_price_one_fourth_first( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_fourth", "first" ); return $output; } function thrive_price_one_fourth_last( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_fourth", "last" ); return $output; } function thrive_price_one_fifth( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_fifth", "normal" ); return $output; } function thrive_price_one_fifth_first( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_fifth", "first" ); return $output; } function thrive_price_one_fifth_last( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'time' => '', 'price' => "", 'btn_text' => "", 'btn_link' => "", 'btn_color' => 'orange', 'highlight' => "", 'btn_size' => 'big' ), $attr ); $output = _thrive_generate_price_shortcode_output( $attr, $content, "price_one_fifth", "last" ); return $output; } function thrive_shortcode_tabs_group( $attr, $content ) { $attr = shortcode_atts( array( 'layout' => 'horz' ), $attr ); global $thrive_tabs_divs; global $thrive_tabs_layout; $thrive_tabs_layout = $attr['layout']; $thrive_tabs_divs = ''; $output = '
' . $thrive_tabs_divs . "
"; return $output; } function thrive_grid_one_half( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $size_class = _thrive_get_grid_shortcode_size_class( $attr['size'] ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "
"; $output .= "

" . $attr['title'] . "

" . $content . "
"; return $output; } function thrive_grid_one_half_last( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "

" . $attr['title'] . "

" . $content . "
"; return $output; } function thrive_grid_one_third_first( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $size_class = _thrive_get_grid_shortcode_size_class( $attr['size'] ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "
"; $output .= "

" . $attr['title'] . "

" . $content . "
"; return $output; } function thrive_grid_one_third( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "

" . $attr['title'] . "

" . $content . "
"; return $output; } function thrive_grid_one_third_last( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "

" . $attr['title'] . "

" . $content . "
"; return $output; } function thrive_grid_one_fourth_first( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $size_class = _thrive_get_grid_shortcode_size_class( $attr['size'] ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "
"; $output .= "

" . $attr['title'] . "

" . $content . "
"; return $output; } function thrive_grid_one_fourth( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "

" . $attr['title'] . "

" . $content . "
"; return $output; } function thrive_grid_one_fourth_last( $attr, $content ) { $attr = shortcode_atts( array( 'img' => '', 'size' => 'small', 'title' => "" ), $attr ); $content = '

' . $content . '

'; // this should keep backwards compatibility $content = shortcode_unautop( $content ); $content = do_shortcode( $content ); $output = "

" . $attr['title'] . "

" . $content . "
"; return $output; } /* * Overwrite the default wordpress gallery shortcode */ function thrive_shortcode_gallery( $attr ) { wp_enqueue_script( 'jquerytouchwipe' ); $post = get_post(); static $instance = 0; $instance ++; if ( ! empty( $attr['ids'] ) ) { // 'ids' is explicitly ordered, unless you specify otherwise. if ( empty( $attr['orderby'] ) ) { $attr['orderby'] = 'post__in'; } $attr['include'] = $attr['ids']; } // Allow plugins/themes to override the default gallery template. $output = apply_filters( 'post_gallery', '', $attr ); if ( $output != '' ) { return $output; } // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if ( isset( $attr['orderby'] ) ) { $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); if ( ! $attr['orderby'] ) { unset( $attr['orderby'] ); } } extract( shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post ? $post->ID : 0, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'large', 'include' => '', 'exclude' => '', 'link' => '' ), $attr, 'gallery' ) ); $gallery_link_class = ""; if ( $link && $link == "none" ) { $gallery_link_class = " no-gallery"; } $id = intval( $id ); if ( 'RAND' == $order ) { $orderby = 'none'; } if ( ! empty( $include ) ) { $_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[ $val->ID ] = $_attachments[ $key ]; } } elseif ( ! empty( $exclude ) ) { $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } if ( empty( $attachments ) ) { return ''; } if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) { $output .= wp_get_attachment_link( $att_id, $size, true ) . "\n"; } return $output; } $itemtag = tag_escape( $itemtag ); $captiontag = tag_escape( $captiontag ); $icontag = tag_escape( $icontag ); $valid_tags = wp_kses_allowed_html( 'post' ); if ( ! isset( $valid_tags[ $itemtag ] ) ) { $itemtag = 'dl'; } if ( ! isset( $valid_tags[ $captiontag ] ) ) { $captiontag = 'dd'; } if ( ! isset( $valid_tags[ $icontag ] ) ) { $icontag = 'dt'; } $columns = intval( $columns ); $itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $rand_gallery_id = rand( 0, 9999 ); $gallery_style = $gallery_div = ''; if ( apply_filters( 'use_default_gallery_style', true ) ) { $gallery_style = " "; } $size_class = sanitize_html_class( $size ); if ( true || $instance == 1 ) { $gallery_div = ""; } $gallery_div = "\n"; return $output; } function thrive_shortcode_custom_menu( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'thumbnails' => 'off', 'menu' => 0 ), $attr ); $menu_items = array(); if ( $attr['menu'] == 0 ) { $menu_ids = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); //get_nav_menu_locations(); foreach ( $menu_ids as $menu ) { $items = wp_get_nav_menu_items( $menu->term_id ); foreach ( $items as $item ) { array_push( $menu_items, $item ); } } } else { $items = wp_get_nav_menu_items( $attr['menu'] ); foreach ( (array) $items as $item ) { array_push( $menu_items, $item ); } } $output = "
"; if ( ! empty( $attr['title'] ) ) { $output .= "

" . $attr['title'] . "

"; } foreach ( $menu_items as $item ) { if ( $attr['thumbnails'] == "on" ) { $featured_img_data = thrive_get_post_featured_image( $item->object_id, "tt_grid_layout" ); $featured_img = $featured_img_data['image_src']; $output .= "
"; if ( $featured_img ) { $output .= "
"; } else { //some default image $output .= "
"; } $output .= "
"; $output .= "" . get_the_title( $item->object_id ) . ""; $output .= "
"; } else { $output .= "
"; $output .= "" . get_the_title( $item->object_id ) . ""; $output .= "
"; } } $output .= ""; return $output; } function thrive_shortcode_custom_phone( $attr, $content ) { $attr = shortcode_atts( array( 'phone_text' => '', 'phone_no' => "", 'mobile_phone_text' => "", 'color' => 'default' ), $attr ); if ( $attr['color'] == 'default' ) { $attr['color'] = thrive_get_theme_options( 'color_scheme' ); } $output = "
"; $output .= $attr['phone_text']; $output .= ""; $output .= ""; $output .= $attr['mobile_phone_text']; $output .= ""; $output .= " " . $attr['phone_no'] . ""; $output .= "
"; return $output; } function thrive_shortcode_custom_font( $attr, $content ) { $font = thrive_get_font_options( $attr['id'] ); if ( $font != null ) { $size_class = ''; if ( strpos( $font->font_size, 'px' ) > 0 ) { if ( str_replace( 'px', '', $font->font_size ) > 70 ) { $size_class = ' mms'; } else { if ( str_replace( 'px', '', $font->font_size ) > 33 ) { $size_class = ' mmt'; } } } $output = '' . do_shortcode( $content ) . ''; } else { $output = $content; } return $output; } function thrive_shortcode_tab( $attr, $content ) { global $thrive_tabs_divs; global $thrive_tabs_layout; $attr = shortcode_atts( array( 'headline' => '', 'no' => "1/1" ), $attr ); $pos = explode( "/", $attr['no'] ); $position = ( isset( $pos[0] ) ) ? $pos[0] : 1; $length = ( isset( $pos[1] ) ) ? $pos[1] : 1; $width_a = ( 100 / $length ) - 1; $rand_id = "scTC" . rand( 1, 1000 ); $class_attr = ""; $style_attr = ""; if ( $position == 1 ) { $class_attr = " class='tS'"; $style_attr = " style='display:block;'"; } else { $style_attr = " style='display:none;'"; } if ( $thrive_tabs_layout == 'horz' ) { $output = "" . $attr['headline'] . ""; } else { $output = "" . $attr['headline'] . ""; } $thrive_tabs_divs .= "

" . do_shortcode( $content ) . "

"; return $output; } function thrive_divider_line( $attr, $content ) { $attr = shortcode_atts( array( 'style' => 'full' ), $attr ); $divider_class = array( 'left' => 'ldivi', 'right' => 'rdivi', 'centered' => 'cdivi', 'full' => 'ddivi', 'split' => 'sdivi' ); if ( ! isset( $divider_class[ $attr['style'] ] ) ) { $attr['style'] = "full"; } return '
'; } function thrive_shortcode_code( $attr, $content ) { return "
" . strip_tags( $content ) . "
"; } function thrive_one_half( $attr, $content ) { $col_class = "colm twc"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_half_first( $attr, $content ) { $col_class = "colm twc"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_half_last( $attr, $content ) { $col_class = "colm twc lst"; $c = _thrive_get_content_for_columns_sc( $content ); $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_third( $attr, $content ) { $col_class = "colm thc"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_third_first( $attr, $content ) { $col_class = "colm thc"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_third_last( $attr, $content ) { $col_class = "colm thc lst"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_two_third( $attr, $content ) { $col_class = "colm tth"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_two_third_first( $attr, $content ) { $col_class = "colm tth"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_two_third_last( $attr, $content ) { $col_class = "colm tth lst"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth( $attr, $content ) { $col_class = "colm foc"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth_first( $attr, $content ) { $col_class = "colm foc"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth_last( $attr, $content ) { $col_class = "colm foc lst"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_three_fourth( $attr, $content ) { $col_class = "colm tfo"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_three_fourth_first( $attr, $content ) { $col_class = "colm tfo"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_three_fourth_last( $attr, $content ) { $col_class = "colm tfo lst"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fifth( $attr, $content ) { $col_class = "colm fic"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fifth_first( $attr, $content ) { $col_class = "colm fic"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fifth_last( $attr, $content ) { $col_class = "colm fic lst"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth_3_first( $attr, $content ) { $col_class = "colm ofo"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth_3_last( $attr, $content ) { $col_class = "colm ofo lst"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth_2( $attr, $content ) { $col_class = "colm fft"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth_2_first( $attr, $content ) { $col_class = "colm fft"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } function thrive_one_fourth_2_last( $attr, $content ) { $col_class = "colm fft lst"; $output = "
" . _thrive_get_content_for_columns_sc( $content ) . "
"; return $output; } /* * Genarate the output for the page section shortcode * The image pattern backgrounds are included from http://www.subtlepatterns.com */ function thrive_shortcode_page_section( $attr, $content ) { $attr = shortcode_atts( array( 'color' => '', 'shadow' => '', 'image' => '', 'image_tablet' => '', 'image_phone' => '', 'pattern' => '', 'textstyle' => 'light', 'template' => 0, 'padding_top' => "off", 'padding_bottom' => "off", 'img_static' => "off", 'fullheight' => "off", 'position' => 'default' ), $attr ); $in_style = ""; $shadow_string = ""; $out_style = ""; $out_class = "out"; $data_href_string = ""; if ( $attr['padding_top'] == "on" && $attr['padding_bottom'] == "on" ) { $out_class = "out dmg"; } else if ( $attr['padding_top'] == "on" ) { $out_class = "out tmg"; } else if ( $attr['padding_bottom'] == "on" ) { $out_class = "out bmg"; } if ( $attr['position'] != "default" ) { $out_class .= " " . $attr['position']; } $text_class = ( $attr['textstyle'] == "light" ) ? "lightSec" : "darkSec"; $in_class = "in"; if ( ! empty( $attr['shadow'] ) ) { $shadow_string = " -webkit-box-shadow: 0 0px 24px " . $attr['shadow'] . " inset; -moz-box-shadow: 0 0px 24px " . $attr['shadow'] . " inset; box-shadow: 0 0px 24px " . $attr['shadow'] . " inset;"; } if ( ! empty( $attr['color'] ) ) { $out_style = "style='background: " . $attr['color'] . ";" . $shadow_string . "'"; } if ( ! empty( $attr['image'] ) ) { if ( $attr['img_static'] != "off" && $attr['fullheight'] != "off" ) { $in_class .= " pdfbg pdwbg"; } elseif ( $attr['img_static'] != "off" && $attr['fullheight'] == "off" ) { $in_class .= " pdwbg"; } elseif ( $attr['fullheight'] != "off" ) { $img_size = @getimagesize( $attr['image'] ); if ( $img_size ) { list( $img_width, $img_height, $img_type, $img_attr ) = @getimagesize( $attr['image'] ); $data_href_string = "data-height='" . $img_height . "' data-width='" . $img_width . "'"; } $in_class .= " pddbg pdfbg"; } else { $in_class .= " pddbg"; } $in_style = "style='background-image: url(\"" . $attr['image'] . "\");" . $shadow_string . "'"; if ( ! empty( $attr['image'] ) ) { $in_style .= "data-full='" . $attr['image'] . "' "; } if ( ! empty( $attr['image_tablet'] ) ) { $in_style .= "data-tablet='" . $attr['image_tablet'] . "' "; } if ( ! empty( $attr['image_phone'] ) ) { $in_style .= "data-phone='" . $attr['image_phone'] . "' "; } if ( ! empty( $attr['image_phone'] ) || ! empty( $attr['image_tablet'] ) ) { $in_class .= " c-img"; } } if ( ! empty( $attr['pattern'] ) ) { $out_style = "style='background: url(\"" . $attr['pattern'] . "\") repeat;" . $shadow_string . "'"; } $attr['template'] = (int) $attr['template']; $current_template = _thrive_get_item_template( get_the_ID() ); if ( ( $current_template == "Full Width" || $current_template == "Landing Page" ) && ( is_single() || is_page() ) ) { $out_class .= " pswr"; } if ( $current_template == "Narrow" && ( is_single() || is_page() ) ) { $out_class .= " nswr"; } if ( $attr['template'] == 0 ) { $output = "
" . do_shortcode( $content ) . "
"; } else { switch ( $attr['template'] ) { case 1: $output = "

" . do_shortcode( $content ) . "

"; break; case 2: $output = "

" . do_shortcode( $content ) . "

"; break; case 3: $output = "

" . do_shortcode( $content ) . "

"; break; } } return $output; } function thrive_shortcode_gmaps( $attr, $content ) { $output = "
" . $content . "
"; return $output; } function thrive_shortcode_text_block( $attr, $content ) { $attr = shortcode_atts( array( 'headline' => '', 'color' => 'blue' ), $attr ); if ( $attr['color'] == "dark" ) { $colour_scheme = "shn"; } else { $colour_scheme = "shnd"; } if ( empty( $attr['headline'] ) ) { $output = "
" . do_shortcode( $content ) . "
"; } else { $output = "

" . $attr['headline'] . "

" . do_shortcode( $content ) . "

"; } return $output; } function thrive_shortcode_pullquote( $attr, $content ) { $attr = shortcode_atts( array( 'align' => 'normal', 'cite' => '' ), $attr ); $container_class = "pulQ"; if ( $attr['align'] == "left" ) { $container_class = "pulQ left"; } if ( $attr['align'] == "right" ) { $container_class = "pulQ right"; } $cite_html = ""; if ( ! empty( $attr['cite'] ) ) { $cite_html = "" . $attr['cite'] . ""; } $output = "

" . $content . "

" . $cite_html . "

"; return $output; } function thrive_shortcode_toggle( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'color' => '' ), $attr ); $color_class = ""; if ( $attr['color'] == 'grey' ) { $color_class = " even"; } $output = "

" . $attr['title'] . "

" . do_shortcode( $content ) . "

"; return $output; } function thrive_shortcode_toggles_group( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '' ), $attr ); $output = '

' . $attr['title'] . '

'; $output .= do_shortcode( $content ); $output .= '
'; return $output; } function thrive_shortcode_toggles( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'no' => '1/1' ), $attr ); $no = explode( '/', $attr['no'] ); $output = '

' . $attr['title'] . '

' . do_shortcode( $content ) . '

'; return $output; } function thrive_shortcode_note_block( $attr, $content ) { $attr = shortcode_atts( array( 'headline' => '' ), $attr ); $output = "

" . $attr['headline'] . "

" . do_shortcode( $content ) . "

"; return $output; } function thrive_shortcode_link( $attr, $content ) { $attr = shortcode_atts( array( 'size' => 'normal', 'color' => 'blue', 'link' => 'javascript:void(0)', 'target' => '_blank', 'align' => '' ), $attr ); if ( empty( $attr['link'] ) ) { $attr['link'] = "javascript:void(0)"; } $btn_class = "btn " . $attr['color'] . " " . $attr['align'] . " " . $attr['size']; $output = "" . $content . ""; if ( $attr['align'] != "left" && $attr['align'] != "right" ) { $output = $output . "
"; } return $output; } function thrive_shortcode_posts_gallery( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'no_posts' => 5, 'filter' => 'recent', 'category' => 0 ), $attr ); if ( $attr['filter'] == "popular" ) { $query_params = array( 'order' => 'DESC', 'orderby' => 'comment_count', 'posts_per_page' => $attr['no_posts'], 'ignore_sticky_posts' => 1 ); if ( $attr['category'] > 0 ) { $query_params['cat'] = $attr['category']; } } else { $query_params = array( 'orderby' => 'date', 'posts_per_page' => $attr['no_posts'], 'ignore_sticky_posts' => 1 ); if ( $attr['category'] > 0 ) { $query_params['cat'] = $attr['category']; } } $query_params['post__not_in'] = array( get_the_ID() ); $r = new WP_Query( $query_params ); $posts = $r->get_posts(); $posts = array_slice( $posts, 0, $attr['no_posts'] ); $output = "
"; if ( ! empty( $attr['title'] ) ) { $output .= "

" . $attr['title'] . "

"; } foreach ( $posts as $p ) { $featured_img_data = thrive_get_post_featured_image( $p->ID, "tt_grid_layout" ); $featured_img = $featured_img_data['image_src']; $output .= ""; } $output .= "
"; return $output; } function thrive_shortcode_posts_list( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'thumbnails' => 'off', 'no_posts' => 5, 'filter' => 'recent', 'category' => 0 ), $attr ); if ( $attr['filter'] == "popular" ) { $query_params = array( 'order' => 'DESC', 'orderby' => 'comment_count', 'posts_per_page' => $attr['no_posts'], 'ignore_sticky_posts' => 1 ); if ( $attr['category'] > 0 ) { $query_params['cat'] = $attr['category']; } $r = new WP_Query( $query_params ); } else { $query_params = array( 'orderby' => 'date', 'posts_per_page' => $attr['no_posts'], 'ignore_sticky_posts' => 1 ); if ( $attr['category'] > 0 ) { $query_params['cat'] = $attr['category']; } $r = new WP_Query( $query_params ); } $posts = $r->get_posts(); $posts = array_slice( $posts, 0, $attr['no_posts'] ); $output = "
"; if ( ! empty( $attr['title'] ) ) { $output .= "

" . $attr['title'] . "

"; } foreach ( $posts as $p ) { if ( $attr['thumbnails'] == "on" ) { $featured_img_data = thrive_get_post_featured_image( $p->ID, "tt_post_icon" ); $featured_img = $featured_img_data['image_src']; $output .= "
"; if ( $featured_img ) { $output .= "
"; } else { //some default image $output .= "
"; } $output .= "
"; $output .= "" . get_the_title( $p->ID ) . ""; $output .= "" . get_the_time( get_option( 'date_format' ), $p->ID ) . "
"; } else { $output .= "
"; $output .= "" . get_the_title( $p->ID ) . ""; $output .= "" . get_the_time( get_option( 'date_format' ), $p->ID ) . "
"; } } $output .= ""; return $output; } function thrive_shortcode_video_page_section( $attr, $content ) { $attr = shortcode_atts( array( 'btn' => '', 'color' => null, 'image' => null, 'pattern' => null, 'heading' => '', 'subheading' => '', 'cta' => '', 'hide_logo' => 0, 'hide_controls' => 0, 'hide_related' => 0, 'hide_title' => 0, 'autoplay' => 0, 'hide_fullscreen' => 0, 'type' => 'custom', 'position' => 'default', 'video_width' => 1080 ), $attr ); $output = ""; $out_class = "out"; if ( $attr['position'] != "default" ) { $out_class .= " " . $attr['position']; } $txt_div_class = ( $attr['btn'] == "light" ) ? "vdc lv" : "vdc dv"; if ( $attr['type'] == "youtube" ) { $video_code = _thrive_get_youtube_embed_code( $content, $attr ); } elseif ( $attr['type'] == "vimeo" ) { $video_code = _thrive_get_vimeo_embed_code( $content, $attr['video_width'] ); } else { $video_code = do_shortcode( $content ); } $wistiaVideoCode = ( strpos( $video_code, "wistia" ) !== false ) ? ' wistia-video-container' : ''; if ( ! is_null( $attr['image'] ) ) { $output = "
"; $output .= "

" . $attr['heading'] . "

" . $attr['subheading'] . "

"; $output .= "

" . $attr['cta'] . "

"; $output .= ""; $output .= "
"; } if ( ! is_null( $attr['pattern'] ) ) { $output = "
"; $output .= "

" . $attr['heading'] . "

" . $attr['subheading'] . "

"; $output .= "

" . $attr['cta'] . "

"; $output .= ""; $output .= "
"; } if ( ! is_null( $attr['color'] ) ) { $output = "
"; $output .= "

" . $attr['heading'] . "

" . $attr['subheading'] . "

"; $output .= "

" . $attr['cta'] . "

"; $output .= ""; $output .= "
"; } return $output; } function thrive_shortcode_testimonal( $attr, $content ) { $attr = shortcode_atts( array( 'name' => '', 'company' => '', 'image' => '' ), $attr ); if ( ! empty( $attr['company'] ) ) { $attr['company'] = ", " . $attr['company']; } $output = ""; $output .= ""; if ( ! empty( $attr['image'] ) ) { $output .= ""; } else { $output .= ""; } $output .= "
" . $content . "
" . $attr['name'] . " " . $attr['company'] . "
"; return $output; } function thrive_shortcode_optin( $attr, $content ) { $attr = shortcode_atts( array( 'color' => '', 'size' => '', 'text' => '', 'optin' => 0, 'layout' => 'vertical' ), $attr ); $optin_id = $attr['optin']; //form action $optinFormAction = get_post_meta( $optin_id, '_thrive_meta_optin_form_action', true ); //form method $optinFormMethod = get_post_meta( $optin_id, '_thrive_meta_optin_form_method', true ); $optinFormMethod = strtolower( $optinFormMethod ); $optinFormMethod = $optinFormMethod === 'post' || $optinFormMethod === 'get' ? $optinFormMethod : 'post'; //form hidden inputs $optinHiddenInputs = get_post_meta( $optin_id, '_thrive_meta_optin_hidden_inputs', true ); //form fields $optinFieldsJson = get_post_meta( $optin_id, '_thrive_meta_optin_fields_array', true ); $optinFieldsArray = json_decode( $optinFieldsJson, true ); //form not visible inputs $optinNotVisibleInputs = get_post_meta( $optin_id, '_thrive_meta_optin_not_visible_inputs', true ); if ( ! is_array( $optinFieldsArray ) ) { return "There are some problems with the configuration of the opt-in shortcode"; } if ( $attr['layout'] == "horizontal" ) { $container_class = ( count( $optinFieldsArray ) >= 3 ) ? "scon wide otit o" . count( $optinFieldsArray ) : "scon wide o" . count( $optinFieldsArray ); } else { $container_class = "scon"; } $output = '
'; $output .= $optinHiddenInputs; $output .= $optinNotVisibleInputs; foreach ( $optinFieldsArray as $name_attr => $field_label ) { $output .= Thrive_OptIn::getInstance()->getInputHtml( $name_attr, $field_label ); } $output .= "
"; return $output; } function thrive_shortcode_follow_me( $attr, $content ) { $attr = shortcode_atts( array( 'facebook' => '', 'twitter' => '', 'gprofile' => '', 'gpage' => '', 'linkedin' => '', 'dribble' => '', 'pinterest' => '', 'rss' => '', 'youtube' => '', 'instagram' => '', 'xing' => '', ), $attr ); $output = "
"; if ( ! empty( $attr['facebook'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; $output .= "
"; $output .= "
"; } if ( ! empty( $attr['twitter'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= ""; $output .= "
"; } if ( ! empty( $attr['gprofile'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; $output .= "
"; $output .= "
"; } if ( ! empty( $attr['gpage'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; $output .= "
"; $output .= "
"; } if ( ! empty( $attr['linkedin'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; $output .= _thrive_get_linkedin_follow_script( $attr['linkedin'] ) . "
"; $output .= "
"; } if ( ! empty( $attr['dribble'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; } if ( ! empty( $attr['pinterest'] ) ) { $randId = rand( 9, 99999 ); $pinterest_user = preg_replace( '#http(s)?://(www\.)?pinterest.com/(.+)#i', '$3', $attr['pinterest'] ); $output .= "
"; $output .= ""; $output .= "
"; } if ( ! empty( $attr['rss'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; } if ( ! empty( $attr['youtube'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; $output .= "
"; $output .= "
"; } if ( ! empty( $attr['instagram'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; $output .= ' Instagram
'; $output .= "
"; } if ( ! empty( $attr['xing'] ) ) { $randId = rand( 9, 99999 ); $output .= "
"; $output .= "
"; } $output .= "
"; return $output; } function thrive_shortcode_borderless( $attr, $content ) { $attr = shortcode_atts( array( 'type' => 'image', 'image_url' => '', 'video_type' => 'youtube', 'youtube_url' => '', 'vimeo_url' => '', 'custom_code' => '', 'hide_logo' => 0, 'hide_controls' => 0, 'hide_related' => 0, 'hide_title' => 0, 'autoplay' => 0, 'hide_fullscreen' => 0, 'position' => 'default' ), $attr ); $output = ""; $container_class = ( $attr['position'] == "default" ) ? "fwi" : "fwi " . $attr['position']; $hasControls = ""; if ( isset( $attr['hide_controls'] ) && $attr['hide_controls'] == 1 ) { $hasControls = "bnoc"; } switch ( $attr['type'] ) { case 'image': $output = "
"; break; case 'youtube': $output = "
" . _thrive_get_youtube_embed_code( $content, $attr ) . "
"; break; case 'vimeo': $output = "
" . _thrive_get_vimeo_embed_code( $content ) . "
"; break; case 'custom_code': $output = "
" . $content . "
"; break; case 'custom_url': $output = "
" . do_shortcode( $content ) . "
"; break; } return $output; } function thrive_shortcode_blank_space( $attr, $content ) { $attr = shortcode_atts( array( 'height' => "30px" ), $attr ); $output = "
 
"; return $output; } function thrive_shortcode_content_container( $attr, $content ) { $attr = shortcode_atts( array( 'max_width' => 600, 'align' => 'left' ), $attr ); $style_str = " style='max-width: " . $attr['max_width'] . "px;'"; $align_class = ( $attr['align'] == "center" ) ? "ced" : $attr['align']; $output = "

" . do_shortcode( $content ) . "

"; return $output; } function thrive_shortcode_responsive_video( $attr, $content ) { $attr = shortcode_atts( array( 'type' => 'youtube', 'image_url' => '', 'video_type' => 'youtube', 'youtube_url' => '', 'vimeo_url' => '', 'custom_code' => '', 'hide_logo' => 0, 'hide_controls' => 0, 'hide_related' => 0, 'hide_title' => 0, 'autoplay' => 0, 'hide_fullscreen' => 0, 'position' => 'default' ), $attr ); $output = ""; $container_class = "rve"; if ( isset( $attr['hide_controls'] ) && $attr['hide_controls'] == 1 ) { $container_class = "rve noc"; } switch ( $attr['type'] ) { case 'youtube': $output = "
" . _thrive_get_youtube_embed_code( $content, $attr ) . "
"; break; case 'vimeo': $output = "
" . _thrive_get_vimeo_embed_code( $content ) . "
"; break; case 'custom_code': $output = "
" . $content . "
"; break; case 'custom_url': $output = "
" . do_shortcode( $content ) . "
"; break; } return $output; } function thrive_shortcode_accordion_group( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '' ), $attr ); $output = '

' . $attr['title'] . '

'; $output .= do_shortcode( $content ); $output .= '
'; return $output; } function thrive_shortcode_accordion( $attr, $content ) { $default = array( 'title' => '', 'default' => 'no' ); $attr = shortcode_atts( $default, $attr ); $output = '

' . $attr['title'] . '

' . do_shortcode( $content ) . '

'; return $output; } function thrive_shortcode_countdown( $attr, $content ) { $attr = shortcode_atts( array( 'year' => '0000', 'month' => '00', 'day' => '00', 'hour' => '00', 'min' => '00', 'fade' => 0, 'text' => '', 'color' => 'light' ), $attr ); $tzstring = thrive_get_timezone_string(); $timezone_offset = get_option( 'gmt_offset' ); $sign = ( $timezone_offset < 0 ? '-' : '+' ); $min = abs( $timezone_offset ) * 60; $hour = floor( $min / 60 ); $tzd = $sign . str_pad( $hour, 2, '0', STR_PAD_LEFT ) . ':' . str_pad( $min % 60, 2, '0', STR_PAD_LEFT ); $date = $attr['year'] . '-' . $attr['month'] . '-' . $attr['day'] . 'T' . $attr['hour'] . ':' . $attr['min'] . ':00' . $tzd; $now = new DateTime( 'now', $tzstring ? new DateTimeZone( $tzstring ) : null ); $output = '
Days
Hours
Minutes
Seconds
'; return $output; } function thrive_shortcode_custom_box( $attr, $content ) { $attr = shortcode_atts( array( 'title' => '', 'style' => 'light', 'type' => 'color', 'image' => '', 'full_height' => 0, 'color' => 'white', 'border' => 'black' ), $attr ); $output = ""; if ( $attr['type'] == "image" ) { $output = "
"; if ( $attr['full_height'] == 1 ) { $output .= "

" . $attr['title'] . "

" . do_shortcode( $content ) . "

"; } else { $output .= "

" . $attr['title'] . "

" . do_shortcode( $content ) . "

"; } $output .= "
"; } else { $output = "

" . $attr['title'] . "

" . do_shortcode( $content ) . "

"; } return $output; } function thrive_shortcode_drop_caps( $attr, $content ) { $attr = shortcode_atts( array( 'style' => '', 'color' => '' ), $attr ); $output = '

' . do_shortcode( $content ) . '

'; return $output; } function thrive_shortcode_fill_counter( $attr, $content ) { $attr = shortcode_atts( array( 'color' => '', 'before' => '', 'value' => '', 'after' => '', 'label' => '', 'percentage' => 0 ), $attr ); $output = '
' . $attr['before'] . '' . $attr['value'] . '' . $attr['after'] . ' ' . $attr['label'] . '
'; return $output; } function thrive_shortcode_headline_focus( $attr, $content ) { $attr = shortcode_atts( array( 'orientation' => '', 'title' => '' ), $attr ); $output = '
' . ( ( $attr['orientation'] != 'left' ) ? '
' : '' ) . '

' . $attr['title'] . '

' . ( ( $attr['orientation'] != 'right' ) ? '
' : '' ) . '
'; return $output; } function thrive_shortcode_number_counter( $attr, $content ) { $attr = shortcode_atts( array( 'color' => '', 'before' => '', 'value' => '', 'after' => '', 'label' => '' ), $attr ); $output = '
' . $attr['before'] . ' 0 ' . $attr['after'] . '
' . $attr['label'] . '
'; return $output; } function thrive_shortcode_progress_bar( $attr, $content ) { $output = ''; for ( $i = 0; $i < $attr['count']; $i ++ ) { if ( ! isset( $attr[ 'color' . $i ] ) ) { $attr[ 'color' . $i ] = "orange"; } if ( ! isset( $attr[ 'percentage' . $i ] ) || ! is_numeric( $attr[ 'percentage' . $i ] ) ) { $attr[ 'percentage' . $i ] = "100"; } if ( $attr[ 'percentage' . $i ] > 100 ) { $attr[ 'percentage' . $i ] = 100; } if ( ! isset( $attr[ 'label' . $i ] ) ) { $attr[ 'label' . $i ] = ""; } $output .= '
' . $attr[ 'label' . $i ] . '
'; } return $output; } function thrive_shortcode_split_button( $attr, $content ) { $attr = shortcode_atts( array( 'left_color' => '', 'right_color' => '', 'left_text' => '', 'right_text' => '', 'left_link' => 'javascript:void(0)', 'right_link' => 'javascript:void(0)' ), $attr ); if ( empty( $attr['left_link'] ) ) { $attr['left_link'] = "javascript:void(0)"; } if ( empty( $attr['right_link'] ) ) { $attr['right_link'] = "javascript:void(0)"; } $output = ''; return $output; } function thrive_shortcode_highlight( $attr, $content ) { $attr = shortcode_atts( array( 'highlight' => '', 'text' => '' ), $attr ); $output = ''; $output .= $content; $output .= ''; return $output; } function thrive_shortcode_icon_box( $attr, $content ) { $attr = shortcode_atts( array( 'color' => '', 'style' => 1, 'image' => '' ), $attr ); $output = '

' . do_shortcode( $content ) . '

'; return $output; } function thrive_shortcode_megabutton( $attr, $content ) { $attr = shortcode_atts( array( 'color' => '', 'mt' => '', 'st' => '', 'link' => 'javascript:void(0)', 'target' => '_blank', 'align' => 'left' ), $attr ); if ( empty( $attr['link'] ) ) { $attr['link'] = "javascript:void(0)"; } $output = '
' . $attr['mt'] . ' ' . $attr['st'] . '
'; if ( $attr['align'] == "left" || $attr['align'] == "right" ) { $output .= "
"; } return $output; }