File: /home/slyfwmm/foar/wp-content/themes/flexfit/framework/functions/shortcodes.php
<?php
/* ----------------------------------------------------- */
/* Shortcodes */
/* ----------------------------------------------------- */
/* Dropcap */
function minti_dropcap( $atts, $content = null ) {
extract(shortcode_atts(array(), $atts));
$out = "<span class='dropcap' >" .$content. "</span>";
return $out;
}
add_shortcode('dropcap', 'minti_dropcap');
/* Accordion Shortcode */
function minti_accordion($atts, $content, $code) {
extract(shortcode_atts(array(
'style' => false
), $atts));
if (!preg_match_all("/(.?)\[(tab)\b(.*?)(?:(\/))?\](?:(.+?)\[\/tab\])?(.?)/s", $content, $matches)) {
return do_shortcode($content);
} else {
$output = '';
for($i = 0; $i < count($matches[0]); $i++) {
$matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
if($i == 0){$first = 'class="firsttitle"';}else{$first = '';}
$output .= '<div class="title"><a href="#acc-' . $i . '" '.$first.'>' . $matches[3][$i]['title'] . '</a></div><div class="inner" id="acc-' . $i . '">' . do_shortcode(trim($matches[5][$i])) .'</div>';
}
return '<div class="accordion">' . $output . '</div>';
}
}
add_shortcode('accordion', 'minti_accordion');
/* ----------------------------------------------------- */
/* Alter Block */
function minti_alert( $atts, $content = null) {
extract( shortcode_atts( array(
'type' => 'warning'
), $atts ) );
//return '<a href="' . $link . '" class="button ' . $color . ' ' . $align . '">' . $content . '</a>';
return '<div class="alert-message ' . $type . '"><a class="close" href="#">×</a><p>' . do_shortcode($content) . '</p></div>';
}
add_shortcode('alert', 'minti_alert');
/* ----------------------------------------------------- */
/* Testimonial */
function minti_testimonial( $atts, $content = null) {
extract( shortcode_atts( array(
'author' => ''
), $atts ) );
//return '<a href="' . $link . '" class="button ' . $color . ' ' . $align . '">' . $content . '</a>';
return '<div class="testimonial">' . do_shortcode($content) . '</div><div class="testimonial-author">' . $author . '</div>';
}
add_shortcode('testimonial', 'minti_testimonial');
/* ----------------------------------------------------- */
/* Responsive */
function minti_responsive( $atts, $content = null) {
extract( shortcode_atts( array(
'show' => 'desktop'
), $atts ) );
//return '<a href="' . $link . '" class="button ' . $color . ' ' . $align . '">' . $content . '</a>';
return '<div class="show-' . $show . '">' . do_shortcode($content) . '</div>';
}
add_shortcode('responsive', 'minti_responsive');
/* ----------------------------------------------------- */
/* List Shortcodes */
function minti_list( $atts, $content = null ) {
extract(shortcode_atts(array(
'type' => 'check'
), $atts));
$out = '<ul class="list">'. do_shortcode($content) . '</ul>';
return $out;
}
add_shortcode('list', 'minti_list');
function minti_item( $atts, $content = null ) {
extract(shortcode_atts(array(
'icon' => 'ok'
), $atts));
$out = '<li class="icon-'.$icon.'">'. do_shortcode($content) . '</li>';
return $out;
}
add_shortcode('item', 'minti_item');
/* ----------------------------------------------------- */
/* Icons */
/*function minti_icon( $atts, $content = null ) {
extract(shortcode_atts(array(
'icon' => 'ok',
'style' => 'default',
'color' => '',
'type' => 'h1'
), $atts));
if($style == 'large') {
$return = " large";
}
elseif($style == 'circle') {
$return = " circle";
}
else{
$return = " default";
}
if($color == '') {
$return2 = "";
}
else{
$return2 = ' style="background-color:'.$color.' !important; color: #ffffff !important;"';
}
if($style == 'circle' && $color != ''){
$return2 = ' style="background-color:#ffffff !important; color: '.$color.' !important;"';
}
if($type == 'h1') {
$return3 = "h1";
}
elseif($type == 'h2') {
$return3 = "h2";
}
elseif($type == 'h3') {
$return3 = "h3";
}
elseif($type == 'h4') {
$return3 = "h4";
}
elseif($type == 'h5') {
$return3 = "h5";
}
elseif($type == 'h6') {
$return3 = "h6";
}
else{
$return3 = "h1";
}
$out = '<'. $return3 .' class="mintiicon'. $return .'"><span class="icon-'. $icon .'"'. $return2 .'></span>'. do_shortcode($content) . '</'. $return3 .'>';
return $out;
}
add_shortcode('icon', 'minti_icon');*/
function minti_icon( $atts, $content = null ) {
extract(shortcode_atts(array(
'icon' => 'ok',
'size' => 'default',
'color' => '',
'circle' => false,
'type' => 'h1'
), $atts));
if($size == 'large') {
$return = " large";
}
else{
$return = " default";
}
if($circle == true) {
$return2 = " circle";
}
else{
$return2 = "";
}
if($circle == true && $color != ''){
$return4 = ' style="background-color:'.$color.' !important; color: #ffffff !important;"';
}
if($circle == false && $color != ''){
$return4 = ' style="background-color:#ffffff !important; color: '.$color.' !important;"';
}
if($circle != true && $color != ''){
$return4 = ' style="background-color:#ffffff !important; color: '.$color.' !important;"';
}
if($type == 'h1') {
$return3 = "h1";
}
elseif($type == 'h2') {
$return3 = "h2";
}
elseif($type == 'h3') {
$return3 = "h3";
}
elseif($type == 'h4') {
$return3 = "h4";
}
elseif($type == 'h5') {
$return3 = "h5";
}
elseif($type == 'h6') {
$return3 = "h6";
}
else{
$return3 = "h1";
}
$out = '<'. $return3 .' class="mintiicon'. $return .''. $return2 .'"><span class="icon-'. $icon .'"'. $return4 .'></span>'. do_shortcode($content) . '</'. $return3 .'>';
return $out;
}
add_shortcode('icon', 'minti_icon');
/* ----------------------------------------------------- */
/* Google Map Shortcodes */
function mapme($attr) {
// default atts
$attr = shortcode_atts(array(
'lat' => '0',
'lon' => '0',
'id' => 'map',
'z' => '1',
'w' => '400',
'h' => '300',
'maptype' => 'ROADMAP',
'address' => '',
'kml' => '',
'kmlautofit' => 'yes',
'marker' => '',
'markerimage' => '',
'traffic' => 'no',
'bike' => 'no',
'fusion' => '',
'start' => '',
'end' => '',
'infowindow' => '',
'infowindowdefault' => 'yes',
'directions' => '',
'hidecontrols' => 'false',
'scale' => 'false',
'scrollwheel' => 'true',
'style' => ''
), $attr);
$returnme = '
<div id="' .$attr['id'] . '" style="width:' . $attr['w'] . 'px;height:' . $attr['h'] . 'px;" class="google_map ' . $attr['style'] . '"></div>
';
//directions panel
if($attr['start'] != '' && $attr['end'] != '')
{
$panelwidth = $attr['w']-20;
$returnme .= '
<div id="directionsPanel" style="width:' . $panelwidth . 'px;height:' . $attr['h'] . 'px;border:1px solid gray;padding:10px;overflow:auto;"></div><br>
';
}
$returnme .= '
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var latlng = new google.maps.LatLng(' . $attr['lat'] . ', ' . $attr['lon'] . ');
var myOptions = {
zoom: ' . $attr['z'] . ',
center: latlng,
scrollwheel: ' . $attr['scrollwheel'] .',
scaleControl: ' . $attr['scale'] .',
disableDefaultUI: ' . $attr['hidecontrols'] .',
mapTypeId: google.maps.MapTypeId.' . $attr['maptype'] . '
};
var ' . $attr['id'] . ' = new google.maps.Map(document.getElementById("' . $attr['id'] . '"),
myOptions);
';
//kml
if($attr['kml'] != '')
{
if($attr['kmlautofit'] == 'no')
{
$returnme .= '
var kmlLayerOptions = {preserveViewport:true};
';
}
else
{
$returnme .= '
var kmlLayerOptions = {preserveViewport:false};
';
}
$returnme .= '
var kmllayer = new google.maps.KmlLayer(\'' . html_entity_decode($attr['kml']) . '\',kmlLayerOptions);
kmllayer.setMap(' . $attr['id'] . ');
';
}
//directions
if($attr['start'] != '' && $attr['end'] != '')
{
$returnme .= '
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
directionsDisplay = new google.maps.DirectionsRenderer();
directionsDisplay.setMap(' . $attr['id'] . ');
directionsDisplay.setPanel(document.getElementById("directionsPanel"));
var start = \'' . $attr['start'] . '\';
var end = \'' . $attr['end'] . '\';
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
';
}
//traffic
if($attr['traffic'] == 'yes')
{
$returnme .= '
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(' . $attr['id'] . ');
';
}
//bike
if($attr['bike'] == 'yes')
{
$returnme .= '
var bikeLayer = new google.maps.BicyclingLayer();
bikeLayer.setMap(' . $attr['id'] . ');
';
}
//fusion tables
if($attr['fusion'] != '')
{
$returnme .= '
var fusionLayer = new google.maps.FusionTablesLayer(' . $attr['fusion'] . ');
fusionLayer.setMap(' . $attr['id'] . ');
';
}
//address
if($attr['address'] != '')
{
$returnme .= '
var geocoder_' . $attr['id'] . ' = new google.maps.Geocoder();
var address = \'' . $attr['address'] . '\';
geocoder_' . $attr['id'] . '.geocode( { \'address\': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
' . $attr['id'] . '.setCenter(results[0].geometry.location);
';
if ($attr['marker'] !='')
{
//add custom image
if ($attr['markerimage'] !='')
{
$returnme .= 'var image = "'. $attr['markerimage'] .'";';
}
$returnme .= '
var marker = new google.maps.Marker({
map: ' . $attr['id'] . ',
';
if ($attr['markerimage'] !='')
{
$returnme .= 'icon: image,';
}
$returnme .= '
position: ' . $attr['id'] . '.getCenter()
});
';
//infowindow
if($attr['infowindow'] != '')
{
//first convert and decode html chars
$thiscontent = htmlspecialchars_decode($attr['infowindow']);
$returnme .= '
var contentString = \'' . $thiscontent . '\';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(marker, \'click\', function() {
infowindow.open(' . $attr['id'] . ',marker);
});
';
//infowindow default
if ($attr['infowindowdefault'] == 'yes')
{
$returnme .= '
infowindow.open(' . $attr['id'] . ',marker);
';
}
}
}
$returnme .= '
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
';
}
//marker: show if address is not specified
if ($attr['marker'] != '' && $attr['address'] == '')
{
//add custom image
if ($attr['markerimage'] !='')
{
$returnme .= 'var image = "'. $attr['markerimage'] .'";';
}
$returnme .= '
var marker = new google.maps.Marker({
map: ' . $attr['id'] . ',
';
if ($attr['markerimage'] !='')
{
$returnme .= 'icon: image,';
}
$returnme .= '
position: ' . $attr['id'] . '.getCenter()
});
';
//infowindow
if($attr['infowindow'] != '')
{
$returnme .= '
var contentString = \'' . $attr['infowindow'] . '\';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(marker, \'click\', function() {
infowindow.open(' . $attr['id'] . ',marker);
});
';
//infowindow default
if ($attr['infowindowdefault'] == 'yes')
{
$returnme .= '
infowindow.open(' . $attr['id'] . ',marker);
';
}
}
}
$returnme .= '</script>';
return $returnme;
?>
<?php
}
add_shortcode('map', 'mapme');
/* ----------------------------------------------------- */
/* Slider */
function minti_slideshow($atts, $content = null){
global $wp_filter;
$the_content_filter_backup = $wp_filter['the_content'];
extract(shortcode_atts(array(
'pausetime' => '3000',
'directionnav' => 'true',
'controlnav' => 'true'
), $atts));
$id = rand(1,9999);
$directory = get_stylesheet_directory_uri();
if($directionnav ==='true'){
$directionnav = 'true';
}else{
$directionnav = 'false';
}
$content = trim($content);
$images = !empty($content)?preg_split("/(\r?\n)/", $content):'';
$themePath = get_template_directory_uri();
if(!empty($images) && is_array($images)){
$content = '';
foreach($images as $image){
$image = trim(strip_tags($image));
if(!empty($image)){
$content .= '<li><img src="'.strip_tags($image).'" title="" alt="" /></li>';
}
}
}
$wp_filter['the_content'] = $the_content_filter_backup;
return <<<HTML
<script type="text/javascript" src="{$directory}/framework/js/jquery.flexslider.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#flex_slider_{$id}').flexslider({
animation: "slide",
directionNav : {$directionnav},
controlNav: {$controlnav},
slideshowSpeed: {$pausetime}
});
});
</script>
<div id="flex_slider_{$id}" class="flexslider inpageslider"><ul class="slides">{$content}</ul></div>
HTML;
}
add_shortcode('slideshow', 'minti_slideshow');
/* ----------------------------------------------------- */
/* Video Shortcodes */
function minti_video($atts, $content=null) {
extract(shortcode_atts(array(
'type' => '',
'id' => '',
'width' => false,
'height' => false,
'autoplay' => ''
), $atts));
if ($height && !$width) $width = intval($height * 16 / 9);
if (!$height && $width) $height = intval($width * 9 / 16) + 25;
if (!$height && !$width){
$height = 320;
$width = 480;
}
//$link = $link?' href="'.$link.'"':'';
$autoplay = ($autoplay == 'yes' ? '1' : false);
if($type == "vimeo") $return = "<div class='video-embed'><iframe src='http://player.vimeo.com/video/$id?autoplay=$autoplay&title=0&byline=0&portrait=0' width='$width' height='$height' class='iframe'></iframe></div>";
else if($type == "youtube") $return = "<div class='video-embed'><iframe src='http://www.youtube.com/embed/$id?HD=1;rel=0;showinfo=0' width='$width' height='$height' class='iframe'></iframe></div>";
else if($type == "dailymotion") $return ="<div class='video-embed'><iframe src='http://www.dailymotion.com/embed/video/$id?width=$width&autoPlay={$autoplay}&foreground=%23FFFFFF&highlight=%23CCCCCC&background=%23000000&logo=0&hideInfos=1' width='$width' height='$height' class='iframe'></iframe></div>";
if (!empty($id)){
return $return;
}
}
add_shortcode('video', 'minti_video');
/* ----------------------------------------------------- */
/* HR */
function minti_hr() {
return '<div class="hr"></div>';
}
add_shortcode('hr', 'minti_hr');
function minti_hr2() {
return '<div class="hr2"></div>';
}
add_shortcode('hr2', 'minti_hr2');
function minti_hr3() {
return '<div class="hr3"></div>';
}
add_shortcode('hr3', 'minti_hr3');
function minti_clear() {
return '<div class="clear"></div>';
}
add_shortcode('clear', 'minti_clear');
function minti_hr4() {
return '<div class="hr4"><span class="seperator"></span><span class="lightborder"></span></div>';
}
add_shortcode('hr4', 'minti_hr4');
function minti_spacer() {
return '<div class="spacer"></div>';
}
add_shortcode('spacer', 'minti_spacer');
/* ----------------------------------------------------- */
/* Teaser */
function minti_teaser( $atts, $content = null) {
extract( shortcode_atts( array(
'type' => 'warning'
), $atts ) );
return '<div class="teaser">' . do_shortcode($content) . '</div>';
}
add_shortcode('teaser', 'minti_teaser');
function minti_teaserbox( $atts, $content = null) {
extract( shortcode_atts( array(
'title' => '',
'button' => '',
'link' => ''
), $atts ) );
return '<div class="teaserbox"><div class="border"><h2 class="highlight">' .$title. '</h2>' . do_shortcode($content) . '<br /><a class="button light normal" href="' .$link. '">' .$button. '<span></span></a></div></div>';
}
add_shortcode('teaserbox', 'minti_teaserbox');
/* ----------------------------------------------------- */
/* Buttons */
function minti_buttons( $atts, $content = null ) {
extract(shortcode_atts(array(
'link' => '#',
'target' => '_self',
'size' => 'normal',
'style' => 'default', //light, dark, normal
'align' =>'',
'icon' => ''
), $atts));
if($icon != '') {
$return = "icon-".$icon;
}
else{
$return = "";
}
$out = "<a href=\"" .$link. "\" target=\"" .$target. "\" class=\"button ".$style." ".$size." ".$align." ".$return."\">" .do_shortcode($content). "<span></span></a>";
return $out;
}
add_shortcode('button', 'minti_buttons');
/* ----------------------------------------------------- */
/* Responsive Images */
function minti_image( $atts, $content = null ) {
extract(shortcode_atts(array(
'src' => '#',
'responsive' => true,
'lightbox' => false
), $atts));
if($responsive == true) {
$return = "responsive";
}
else{
$return = "";
}
if($lightbox == true) {
$return2 = '<a href="'.$src.'">';
$return3 = '</a>';
}
$out = $return2 . '<img src="' . $src . '" class="' . $return . '">' . $return3;
return $out;
}
add_shortcode('image', 'minti_image');
/* ----------------------------------------------------- */
/* Toggle Shortcode */
function minti_toggle( $atts, $content = null)
{
extract(shortcode_atts(array(
'title' => '',
), $atts));
return '<div class="toggle"><div class="title">'.$title.'<span></span></div><div class="inner"><div>'. do_shortcode($content) . '</div></div></div>';
}
add_shortcode('toggle', 'minti_toggle');
/* ----------------------------------------------------- */
/* Tabs Shortcode */
function minti_tabs($atts, $content = null, $code) {
extract(shortcode_atts(array(
), $atts));
if (!preg_match_all("/(.?)\[(tab)\b(.*?)(?:(\/))?\](?:(.+?)\[\/tab\])?(.?)/s", $content, $matches)) {
return do_shortcode($content);
} else {
for($i = 0; $i < count($matches[0]); $i++) {
$matches[3][$i] = shortcode_parse_atts($matches[3][$i]);
}
$output = '<ul class="tabNavigation clearfix">';
for($i = 0; $i < count($matches[0]); $i++) {
$output .= '<li><a title="' . $matches[3][$i]['title'] . '" href="#tab-' . $i . '">' . $matches[3][$i]['title'] . '</a></li>';
}
$output .= '</ul><div class="clearnav"></div>';
for($i = 0; $i < count($matches[0]); $i++) {
$output .= '<div id="tab-' . $i . '">' . do_shortcode(trim($matches[5][$i])) .'</div>';
}
return '<div class="tabs">' . $output . '</div>';
}
}
add_shortcode('tabs', 'minti_tabs');
/* ----------------------------------------------------- */
/* Pricing Table */
function minti_plan( $atts, $content = null ) {
extract(shortcode_atts(array(
'name' => 'Premium',
'link' => 'http://www.google.de',
'linkname' => 'Sign Up',
'price' => '39.00$',
'per' => false,
'color' => false, // grey, green, red, blue
'featured' => false
), $atts));
if($featured == true) {
$return = " featured";
$return2 = "";
}
else{
$return = "";
$return2 = "light";
}
if($per != false) {
$return3 = "".$per."";
}
else{
$return3 = "";
}
$return5 = "";
if($color != false) {
if($featured == true){
$return5 = "style='color:".$color.";' ";
}
$return4 = "style='color:".$color.";' ";
}
else{
$return4 = "";
}
$out = "
<div class='plan".$return."' ".$return5.">
<div class='plan-head'><h3 ".$return4.">".$name."</h3>
<div class='price' ".$return4.">".$price." <span>".$return3."</span></div></div>
<ul>" .do_shortcode($content). "</ul><div class='signup'><a class='button ".$return2."' href='".$link."'>".$linkname."<span></span></a></div>
</div>";
return $out;
}
add_shortcode('plan', 'minti_plan');
/* ----------------------------------------------------- */
/* Pricing Table */
function minti_pricing( $atts, $content = null ) {
extract(shortcode_atts(array(
'col' => '3'
), $atts));
$out = "<div class='pricing-table col-".$col."'>" .do_shortcode($content). "</div><div class='clear'></div>";
return $out;
}
add_shortcode('pricing-table', 'minti_pricing');
/* ----------------------------------------------------- */
/* Columns */
function minti_one_third( $atts, $content = null ) {
return '<div class="one_third">' . do_shortcode($content) . '</div>';
}
add_shortcode('one_third', 'minti_one_third');
function minti_one_third_last( $atts, $content = null ) {
return '<div class="one_third last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('one_third_last', 'minti_one_third_last');
function minti_two_third( $atts, $content = null ) {
return '<div class="two_third">' . do_shortcode($content) . '</div>';
}
add_shortcode('two_third', 'minti_two_third');
function minti_two_third_last( $atts, $content = null ) {
return '<div class="two_third last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('two_third_last', 'minti_two_third_last');
function minti_one_half( $atts, $content = null ) {
return '<div class="one_half">' . do_shortcode($content) . '</div>';
}
add_shortcode('one_half', 'minti_one_half');
function minti_one_half_last( $atts, $content = null ) {
return '<div class="one_half last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('one_half_last', 'minti_one_half_last');
function minti_one_fourth( $atts, $content = null ) {
return '<div class="one_fourth">' . do_shortcode($content) . '</div>';
}
add_shortcode('one_fourth', 'minti_one_fourth');
function minti_one_fourth_last( $atts, $content = null ) {
return '<div class="one_fourth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('one_fourth_last', 'minti_one_fourth_last');
function minti_three_fourth( $atts, $content = null ) {
return '<div class="three_fourth">' . do_shortcode($content) . '</div>';
}
add_shortcode('three_fourth', 'minti_three_fourth');
function minti_three_fourth_last( $atts, $content = null ) {
return '<div class="three_fourth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('three_fourth_last', 'minti_three_fourth_last');
function minti_one_fifth( $atts, $content = null ) {
return '<div class="one_fifth">' . do_shortcode($content) . '</div>';
}
add_shortcode('one_fifth', 'minti_one_fifth');
function minti_one_fifth_last( $atts, $content = null ) {
return '<div class="one_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('one_fifth_last', 'minti_one_fifth_last');
function minti_two_fifth( $atts, $content = null ) {
return '<div class="two_fifth">' . do_shortcode($content) . '</div>';
}
add_shortcode('two_fifth', 'minti_two_fifth');
function minti_two_fifth_last( $atts, $content = null ) {
return '<div class="two_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('two_fifth_last', 'minti_two_fifth_last');
function minti_three_fifth( $atts, $content = null ) {
return '<div class="three_fifth">' . do_shortcode($content) . '</div>';
}
add_shortcode('three_fifth', 'minti_three_fifth');
function minti_three_fifth_last( $atts, $content = null ) {
return '<div class="three_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('three_fifth_last', 'minti_three_fifth_last');
function minti_four_fifth( $atts, $content = null ) {
return '<div class="four_fifth">' . do_shortcode($content) . '</div>';
}
add_shortcode('four_fifth', 'minti_four_fifth');
function minti_four_fifth_last( $atts, $content = null ) {
return '<div class="four_fifth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('four_fifth_last', 'minti_four_fifth_last');
function minti_one_sixth( $atts, $content = null ) {
return '<div class="one_sixth">' . do_shortcode($content) . '</div>';
}
add_shortcode('one_sixth', 'minti_one_sixth');
function minti_one_sixth_last( $atts, $content = null ) {
return '<div class="one_sixth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('one_sixth_last', 'minti_one_sixth_last');
function minti_five_sixth( $atts, $content = null ) {
return '<div class="five_sixth">' . do_shortcode($content) . '</div>';
}
add_shortcode('five_sixth', 'minti_five_sixth');
function minti_five_sixth_last( $atts, $content = null ) {
return '<div class="five_sixth last">' . do_shortcode($content) . '</div><div class="clear"></div>';
}
add_shortcode('five_sixth_last', 'minti_five_sixth_last');
/*-----------------------------------------------------------------------------------*/
/* Clear <br> and <p> Tags to validate */
function minti_formatter($content) {
$new_content = '';
/* Matches the contents and the open and closing tags */
$pattern_full = '{(\[raw\].*?\[/raw\])}is';
/* Matches just the contents */
$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
/* Divide content into pieces */
$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
/* Loop over pieces */
foreach ($pieces as $piece) {
/* Look for presence of the shortcode */
if (preg_match($pattern_contents, $piece, $matches)) {
/* Append to content (no formatting) */
$new_content .= $matches[1];
} else {
/* Format and append to content */
$new_content .= wptexturize(wpautop($piece));
}
}
return $new_content;
}
// Remove the 2 main auto-formatters
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');
// Before displaying for viewing, apply this function
add_filter('the_content', 'minti_formatter', 99);
add_filter('widget_text', 'minti_formatter', 99);
/* ----------------------------------------------------- */
/* EOF */
/* ----------------------------------------------------- */
?>