function rt_table_columns($atts, $content = null) { //[table_column caption="" price="" info="" style=""] //defaults extract(shortcode_atts(array("id" => '', "class" => '', "style" => '', "caption" => '', "price" => '', "info" => ''), $atts)); $output = '<div id="' . $id . '" class="table_wrap ' . $style . ' ' . $class . '" data-rt-animate="animate" data-rt-animation-type="fadeInDown"><ul>'; $info_output = sprintf(' <small> %s </small> ', $info); $output .= !empty($caption) && $style != "features" ? sprintf(' <li class="caption"> <div class="title">%s%s</div> </li> ', $caption, $info_output) : '<li class="caption empty"></li>'; $output .= !empty($price) && $style != "features" ? sprintf(' <li class="price"> <div> <span>%s</span> </div> </li> ', $price) : '<li class="price empty"></li>'; $content = preg_replace('/<ul>/', '', $content, 1); if ($style != "features") { $content = preg_replace('/<li>/', '<li class="start_position">', $content, 1); } else { $content = preg_replace('/<li>/', '<li class="features_start_position">', $content, 1); } $output .= rt_visual_composer_content_fix($content); $output .= '</div>'; return $output; }
/** * Timeline Single Event Shortcode * * @param array $atts * @param string $content * @return html $holder_output */ function rt_tl_event($atts, $content = null) { extract(shortcode_atts(array("id" => '', "class" => '', "day" => '', "month" => '', "year" => '', "title" => ''), $atts)); //content $content = rt_visual_composer_content_fix(do_shortcode($content)); //title $title_output = !empty($title) ? '<h4 class="event-title">' . $title . '</h4>' : ""; //output $date_output = sprintf(' <span class="event-date"> <span class="day">%1$s</span> <span class="month">%2$s</span> <span class="year">%3$s</span> </span> ', $day, $month, $year); //id attr $id_attr = !empty($id) ? 'id="' . $id . '"' : ""; //class attr $class_attr = !empty($class) ? 'class="' . $class . '"' : ""; //output $output = sprintf(' <div %1$s %2$s> %3$s<div class="event-details">%4$s%5$s</div> </div> ', $id_attr, $class_attr, $date_output, $title_output, $content); return $output; }
/** * Chained Contents Single Item Shortcode * * @param array $atts * @param string $content * @return html $output */ function rt_chained_content($atts, $content = null) { global $rt_content_counter, $rt_chain_stlye; $rt_content_counter++; extract(shortcode_atts(array("id" => '', "class" => '', "title" => '', "icon_name" => ''), $atts)); //title $title_output = !empty($title) ? '<h4 class="list-title">' . $title . '</h4>' : ""; //content $content = rt_visual_composer_content_fix(do_shortcode($content)); //id attr $id_attr = !empty($id) ? 'id="' . $id . '"' : ""; //the box output if ($rt_chain_stlye == 1 || $rt_chain_stlye == 3) { //icon output $box_output = !empty($icon_name) ? '<span class="' . $icon_name . ' icon"></span>' : ""; } else { //number output $box_output = '<span class="number">' . $rt_content_counter . '</span>'; } //output $output = sprintf(' <div %1$s class="%2$s" data-rt-animate="animate" data-rt-animation-type="fadeInDown"> %3$s<div class="list-content">%4$s%5$s</div> </div> ', $id_attr, $class, $box_output, $title_output, $content); return $output; }
/** * Accordions Single Content Shortcode * * @param array $atts * @param string $content * @return html $panes */ function rt_shortcode_accordion_panel($atts, $content = null) { global $rt_accordion_number_count, $rt_accordion_style, $rt_accordion_first_open; //defaults extract(shortcode_atts(array("id" => '', "class" => '', "title" => '', "icon_name" => 'icon_name'), $atts)); //fix shortcode $content = rt_visual_composer_content_fix(do_shortcode($content)); //id attr $id_attr = !empty($id) ? 'id="' . sanitize_html_class($id) . '"' : ""; //class $class .= $rt_accordion_first_open && $rt_accordion_number_count == 1 ? " open" : ""; $panes = ""; $panes .= '<li ' . $id_attr . ' class="' . sanitize_html_class($class) . '">'; $panes .= '<div class="toggle-head">'; if ($rt_accordion_style == "numbered") { $panes .= '<div class="toggle-number">' . $rt_accordion_number_count . '</div>'; } if ($rt_accordion_style == "icons") { $panes .= '<div class="toggle-number"><span class="' . $icon_name . '"></span></div>'; } $panes .= '<div class="toggle-title">' . $title . '</div>'; $panes .= '</div>'; $panes .= '<div class="toggle-content">'; $panes .= $content; $panes .= '</div>'; $panes .= '</li>'; $rt_accordion_number_count++; return $panes; }
/** * RT Slide * returns html ouput of a slide * * @param [array] $atts * @param [string] $content * @return [string] $output */ function rt_slide($atts, $content = null) { global $rt_slider_min_height; //defaults extract(shortcode_atts(array("class" => '', "content_width" => 600, "content_wrapper_width" => "default", "content_bg_color" => "", "content_color_schema" => "", "content_align" => "right", 'bg_color' => '', 'bg_image' => '', 'bg_image_repeat' => '', 'bg_position' => '', 'bg_size' => '', 'top_margin' => '', 'link' => '', 'link_target' => '_self', 'link_title' => ''), $atts)); $style_output = $content_style_output = $content_class = ""; //get slide content ob_start(); echo do_shortcode(rt_visual_composer_content_fix($content)); $get_slide_content = ob_get_contents(); ob_end_clean(); //css class $class = !empty($class) ? sanitize_html_class($class) : ""; //color schema $class .= !empty($content_color_schema) ? " " . sanitize_html_class($content_color_schema) : ""; //bg values if (!empty($bg_image)) { $bg_image = rt_get_attachment_image_src($bg_image); //background image $style_output .= 'background-image: url(' . $bg_image . ');'; //background repeat $style_output .= !empty($bg_image_repeat) ? 'background-repeat: ' . $bg_image_repeat . ';' : ""; //background size $style_output .= !empty($bg_size) ? 'background-size: ' . $bg_size . ';' : ""; //background attachment //$style_output .= ! empty( $bg_attachment ) ? 'background-attachment: '.$bg_attachment.';': ""; //background position $style_output .= !empty($bg_position) ? 'background-position: ' . $bg_position . ';' : ""; } //background color $style_output .= !empty($bg_color) ? 'background-color: ' . $bg_color . ';' : ""; //height $style_output .= !empty($rt_slider_min_height) ? 'min-height: ' . $rt_slider_min_height . 'px;' : ""; //content width $content_style_output .= !empty($content_width) ? 'width: ' . $content_width . '%;' : ""; //content bg color $content_style_output .= !empty($content_bg_color) ? 'background-color: ' . $content_bg_color . ';' : ""; //content class $content_class .= !empty($content_align) ? " " . $content_align : ""; //content top margin $content_style_output .= !empty($top_margin) ? 'margin-top: ' . $top_margin . 'px;' : ""; //style outputs $style_output = !empty($style_output) ? 'style="' . $style_output . '"' : ""; $content_style_output = !empty($content_style_output) ? 'style="' . $content_style_output . '"' : ""; $link_output = !empty($link) ? '<a href="' . esc_url($link) . '" target="' . $link_target . '" title="' . sanitize_text_field($link_title) . '"></a>' : ""; return sprintf(' <div class="item %s" %s> %s <div class="slide-content-wrapper %s clearfix"> <div class="slide-content animation %s" %s> %s </div> </div> </div>', $class, $style_output, $link_output, $content_wrapper_width, $content_class, $content_style_output, $get_slide_content); }
/** * Content Box With Icon * @param array $atts * @param string $content * @return html $output */ function rt_content_icon_box($atts, $content = null) { //defaults extract(shortcode_atts(array("id" => "", "class" => "", "icon_name" => "", "icon_style" => "", "icon_position" => "left", "link" => "", "link_text" => "", "link_target" => "_self", "heading_size" => "h4", "heading" => ""), $atts)); //class $class .= ' icon-content-box content-box'; //icon postion $class .= ' icon-' . $icon_position; //icon stlye $class .= ' icon-' . $icon_style; //icon $icon = !empty($icon_name) ? $icon_name : ""; //link target $link_target = !empty($link_target) ? $link_target : '_self'; //icon output $icon_output = $icon ? '<span class="' . $icon . '"></span>' : ""; //icon output with link $icon_output = !empty($link) ? '<a href="' . $link . '" title="' . $link_text . '" target="' . $link_target . '">' . $icon_output . '</a>' : $icon_output; //heading $heading_output = !empty($heading) ? sprintf('<%1$s class="heading">%2$s</%1$s>', $heading_size, $heading) : ""; $heading_output = !empty($link) && !empty($heading) ? sprintf(' <%1$s class="heading"> <a href="%3$s" title="%4$s" target="%5$s"> %2$s </a> </%1$s>', $heading_size, $heading, $link, sanitize_text_field($heading), $link_target) : $heading_output; //text $text = rt_visual_composer_content_fix(do_shortcode($content)); if ($icon_position == "top") { //centered paragraphs $changes = array('<p>' => '<p class="aligncenter">'); $text = strtr($text, $changes); } //link output $link_output = ""; if (!empty($link) && !empty($link_text)) { if ($icon_position == "top") { $link_output .= '<a class="read_more centered" href="' . $link . '" title="' . $link_text . '" target="' . $link_target . '">' . $link_text . '</a>'; } else { $link_output .= '<a class="read_more" href="' . $link . '" title="' . $link_text . '" target="' . $link_target . '">' . $link_text . '</a>'; } } //id attr $id = !empty($id) ? 'id="' . sanitize_html_class($id) . '"' : ""; //class attr $class = !empty($class) ? 'class="' . trim($class) . '"' : ""; //final output $output = ""; $output .= '<article ' . $id . ' ' . $class . '>'; $output .= '<div class="icon-holder">' . $icon_output . '</div>'; $output .= '<div class="text-holder">' . $heading_output . ' ' . $text . '' . $link_output . '</div>'; $output .= '</article>'; return $output; }
/** * Banner Box Shortcode * * @param array $atts * @param string $content * @return html $banner */ function rt_shortcode_banner($atts, $content = null) { //defaults extract(shortcode_atts(array("id" => "", "class" => "", "text_alignment" => 'left', "button_text" => '', "button_icon" => '', "button_link" => '', "button_size" => 'small', "button_style" => 'default', "href_title" => '', "link_target" => '_self'), $atts)); # # Button # $withbutton = $button = ""; $href_title = !empty($href_title) ? $href_title : $button_text; //button format $button_format = ' [button button_size = "' . $button_size . '" button_text = "' . $button_text . '" button_link = "' . $button_link . '" button_icon = "' . $button_icon . '" button_style = "' . $button_style . '" href_title = "' . $href_title . '" link_open = "' . $link_target . '" ] '; !empty($button_text) and $button = '<div class="button_holder"><div>' . do_shortcode($button_format) . '</div></div>'; # # Banner # //id attr $id_attr = !empty($id) ? 'id="' . $id . '"' : ""; //withbutton !empty($button_text) and $class .= "withbutton"; //banner format if ($text_alignment == "left") { $banner_format = ' <div %1$s class="banner %2$s clearfix" data-rt-animate="animate" data-rt-animation-type="fadeIn" data-rt-animation-group="single" > <div class="featured_text"> %3$s </div> %4$s </div> '; } else { $banner_format = ' <div %1$s class="banner %2$s clearfix" data-rt-animate="animate" data-rt-animation-type="fadeIn" data-rt-animation-group="single" > <div class="featured_text"> %3$s </div> %4$s </div> '; } //banner output $banner = sprintf($banner_format, $id_attr, $class, rt_visual_composer_content_fix(do_shortcode($content)), $button); return $banner; }
/** * Image Gallery - Single Image Shortcode * * @param array $atts * @param string $content * @return html */ function rt_gal_item($atts, $content = null) { global $rt_image_gallery_globals, $rt_global_variables; //defaults extract(shortcode_atts(array("id" => '', "class" => '', "image_id" => '', "image_url" => '', "custom_link" => '', "title" => '', "action" => 'lightbox', "link_target" => '_self'), $atts)); //variables $output = $caption_output = $lightbox_link = $image_effect = ""; // Thumbnail width & height $w = rt_get_min_resize_size($rt_image_gallery_globals["list_layout"]); $h = $rt_image_gallery_globals["crop"] == "true" ? $w : 10000; // Get image data $image_args = array("image_url" => $image_url, "image_id" => $image_id, "w" => $w, "h" => $h, "crop" => $rt_image_gallery_globals["crop"]); $image_output = rt_get_image_data($image_args); //tooltip $tooltip = $rt_image_gallery_globals["tooltips"] == "true" ? ' data-placement="top" data-toggle="tooltip" data-original-title="' . $title . '"' : ""; //create lightbox link if ($action == "lightbox") { $image = rt_create_lightbox_link(array('class' => 'zoom lightbox_ imgeffect', 'href' => $image_output["image_url"], 'title' => $title, 'data_group' => $rt_image_gallery_globals["gallery_id"], 'data_title' => $title, 'data_description' => "", 'tooltip' => $rt_image_gallery_globals["tooltips"], 'data_thumbnail' => $image_output["lightbox_thumbnail"], 'inner_content' => '<img src="' . $image_output["thumbnail_url"] . '" alt="' . $title . '" class="img-responsive">', 'echo' => false)); } elseif ($action == "custom_link") { $image = sprintf(' <a href="%1$s" title="%2$s" target="%3$s" class="link icon imgeffect"> <img src="%4$s" class="img-responsive" alt="%2$s"%5$s> </a>', $custom_link, $title, $link_target, $image_output["thumbnail_url"], $tooltip); } else { $image = sprintf('<img src="%s" class="img-responsive" alt="%s"%s> ', $image_output["thumbnail_url"], $title, $tooltip); } //create caption $caption_output = !empty($content) ? '<div class="caption">' . rt_visual_composer_content_fix($content, "true") . '</div>' : ""; //open holder if ($rt_image_gallery_globals["counter"] % $rt_image_gallery_globals["column_count"] == 1 || $rt_image_gallery_globals["column_count"] == 1) { $output .= '<div class="row fixed_heights">'; } //id attr $id_attr = !empty($id) ? 'id="' . $id . '"' : ""; //list items output $output .= sprintf(' <div %1$s class="col %3$s col-xs-12 %2$s"> %4$s %5$s </div> ', $id_attr, $class, rt_column_class($rt_image_gallery_globals["list_layout"]), $image, $caption_output); //close holder if ($rt_image_gallery_globals["counter"] % $rt_image_gallery_globals["column_count"] == 0 || $rt_image_gallery_globals["item_count"] == $rt_image_gallery_globals["counter"]) { $output .= '</div>'; } //increase counter $rt_image_gallery_globals["counter"]++; return $output; }
/** * Content Box With Image * @param array $atts * @param string $content * @return html $output */ function rt_content_box($atts, $content = null) { //defaults extract(shortcode_atts(array("id" => "", "class" => "", "featured_image" => "", "style" => "style-1", "link" => "", "link_text" => "", "link_target" => "_self", "heading_size" => "h4", "heading" => "", "text_color" => "", "text_align" => "left", "image_mask_color" => ""), $atts)); //class $class .= ' image-content-box content-box'; //box style $class .= ' box-' . $style; //text align $class .= ' ' . $text_align; $text_color_css = $mask_css = ""; if ($style == "style-2") { //font color css $text_color_css = $text_color ? 'style="color:' . $text_color . '"' : ""; //mask css $mask_css = $image_mask_color ? 'style="background-color:' . $image_mask_color . '"' : ""; } //featured image output $featured_image_output = $image_url = ""; if (!empty($featured_image)) { $image_alternative_text = get_post_meta($featured_image, '_wp_attachment_image_alt', true); $image_url = wp_get_attachment_image_src($featured_image, "full"); $image_url = is_array($image_url) ? $image_url[0] : ""; if (!empty($image_url)) { //create img src $featured_image_output = '<img class="img-responsive" src="' . $image_url . '" alt="' . $image_alternative_text . '" />'; //add links to the featured image $featured_image_output = !empty($link) ? '<a href="' . $link . '" title="' . $link_text . '" target="' . $link_target . '">' . $featured_image_output . '</a>' : $featured_image_output; //add holder $featured_image_output = '<div class="featured_image_holder">' . $featured_image_output . '</div>'; } } //heading $heading_output = !empty($heading) ? sprintf('<%1$s class="heading">%2$s</%1$s>', $heading_size, $heading) : ""; $heading_output = !empty($link) && !empty($heading) ? sprintf(' <%1$s class="heading" %6$s> <a href="%3$s" title="%4$s" target="%5$s" %6$s> %2$s </a> </%1$s>', $heading_size, $heading, $link, sanitize_text_field($heading), $link_target, $text_color_css) : $heading_output; //text $text = rt_visual_composer_content_fix(do_shortcode($content)); //link target $link_target = !empty($link_target) ? $link_target : '_self'; //link output $link_output = ""; if (!empty($link) && !empty($link_text)) { $link_output .= '<a class="read_more" href="' . $link . '" title="' . $link_text . '" target="' . $link_target . '" ' . $text_color_css . '>' . $link_text . '</a>'; } //id attr $id = !empty($id) ? 'id="' . sanitize_html_class($id) . '"' : ""; //class attr $class = !empty($class) ? 'class="' . trim($class) . '"' : ""; //final output if ($style == "style-1") { //style 1 $output = ""; $output .= '<article ' . $id . ' ' . $class . '>'; $output .= $featured_image_output; $output .= '<div class="text-holder">' . $heading_output . ' ' . $text . '' . $link_output . '</div>'; $output .= '</article>'; } else { //style 2 $output = ""; $output .= ' <article ' . $id . ' ' . $class . '> <div class="background" style="background:url(' . $image_url . ') no-repeat scroll center center / cover ;"> <div class="text-holder" ' . $text_color_css . '> ' . $heading_output . ' ' . $text . ' ' . $link_output . ' </div> <div class="mask" ' . $mask_css . '></div> </div> </article> '; } return $output; }