wp/wp-content/themes/IN-MOTION-package-u1/in-motion/functions/shortcodes.php
author ymh <ymh.work@gmail.com>
Wed, 06 Nov 2013 03:21:17 +0000
changeset 0 d970ebf37754
child 1 f6eb5a861d2f
permissions -rwxr-xr-x
first import

<?php

//heading shortcodes
$return='';

function heading1( $atts, $content = null ) {
   return '<h1>' . do_shortcode($content) . '</h1>';
}
add_shortcode('h1', 'heading1');

function clear( $atts, $content = null ) {
   return '<div class="clearfix"></div>';
}
add_shortcode('clear', 'clear');

function heading2( $atts, $content = null ) {
   return '<h2>' . do_shortcode($content) . '</h2>';
}
add_shortcode('h2', 'heading2');

function heading3( $atts, $content = null ) {
	$return = '<h3>';
	$return .= do_shortcode($content);
    $return .= '</h3>';
	return $return;
}
add_shortcode('h3', 'heading3');

function heading4( $atts, $content = null ) {
   return '<h4>' . do_shortcode($content) . '</h4>';
}
add_shortcode('h4', 'heading4');

function alignment( $atts, $content = null  ) {
		extract( shortcode_atts( array(
		'alignment' => 'center'
	), $atts ) );  
	return '<div style="text-align:'.$alignment.';">'. do_shortcode($content) .'</div>';
	 	
}
add_shortcode('alignment', 'alignment');


function seperator( $atts, $content = null ) {
   return '<div class="seperator" class="seperatorExtra"></div>';
}
add_shortcode('seperator', 'seperator');

function para( $atts, $content = null ) {
   return '<p>' . do_shortcode($content) . '</p>';
}
add_shortcode('p', 'para');

//layout shortcodes
function one_half( $atts, $content = null ) {
   	$return = '<div  class="one-half">';
	$return .= do_shortcode($content);
    $return .= '</div>';
	return $return;
}
add_shortcode('one_half', 'one_half');


function one_half_last( $atts, $content = null ) {
    $return = '<div  class="one-half-last">';
	$return .= do_shortcode($content);
    $return .= '</div><div class="clearfix"></div>';
	return $return;
 }
add_shortcode('one_half_last', 'one_half_last');


function one_third ( $atts, $content = null ) {
	$return = '<div  class="one-third">';
	$return .= do_shortcode($content);
    $return .= '</div>';
	return $return;
}
add_shortcode('one_third', 'one_third');


function one_third_last( $atts, $content = null ) {
	$return = '<div  class="one-third last-column">';
	$return .= do_shortcode($content);
    $return .= '</div><div class="clearfix"></div>';
	return $return;
}
add_shortcode('one_third_last', 'one_third_last');

function one_fourth ( $atts, $content = null ) {
   	$return = '<div  class="one-fourth">';
	$return .= do_shortcode($content);
    $return .= '</div>';
	return $return;
   
}
add_shortcode('one_fourth', 'one_fourth');


function one_fourth_last( $atts, $content = null ) {
    $return = '<div  class="one-fourth last-column">';
	$return .= do_shortcode($content);
    $return .= '</div><div class="clearfix"></div>';
	return $return;
   }
add_shortcode('one_fourth_last', 'one_fourth_last');

function two_third ( $atts, $content = null ) {
    $return = '<div  class="two-third">';
	$return .= do_shortcode($content);
    $return .= '</div>';
	return $return;
}
add_shortcode('two_third', 'two_third');


function two_third_last( $atts, $content = null ) {
	$return = '<div  class="one-third last-column">';
	$return .= do_shortcode($content);
    $return .= '</div><div class="clearfix"></div>';
	return $return;
}
add_shortcode('two_third_last', 'two_third_last');

function three_fourth ( $atts, $content = null ) {
   return '<div  class="three-fourth">' . do_shortcode($content) . '</div>';
}
add_shortcode('three_fourth', 'three_fourth');


function three_fourth_last( $atts, $content = null ) {
   return '<div  class="three-fourth-last last-column">' . do_shortcode($content) . '</div><div class="clearfix"></div>';
}
add_shortcode('three_fourth_last', 'three_fourth_last');


//buttons

function button( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'url' => '#',
		'color' => 'black',
		'type' => 'small'
	), $atts ) );

	  
	return '<div class="button"><a class="'.$type.'" href="'.$url.'">' . do_shortcode($content) . '</a></div>';
}

add_shortcode('button', 'button');


function highlight( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'color' => ''
	), $atts ) );
	$return = '<span class="hl '.$color.'"> ';
	$return .= do_shortcode($content);
    $return .= ' </span>';
	return $return;
}

add_shortcode('hl', 'highlight');

function highlight_main( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'color' => ''
	), $atts ) );
	  
	return '<span class="hl-main"> ' . do_shortcode($content) .' </span>';
}

add_shortcode('main-hl', 'highlight_main');



function youtube_video( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'id' => '',
		'width' => '560',
		'height' => '315'
	), $atts ) );
	  
	return '<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$id.'" frameborder="0" allowfullscreen></iframe>';
}

add_shortcode('youtube', 'youtube_video');


function vimeo_video( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'id' => '',
		'width' => '560',
		'height' => '315'
	), $atts ) );
	  
	return '<iframe src="http://player.vimeo.com/video/'.$id.'?title=0&amp;byline=0&amp;portrait=0" width="'.$width.'" height="'.$height.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
}

add_shortcode('vimeo', 'vimeo_video');


function image( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'type' => '',
		'src' => '',
		'title' => '',
		'alt' => '',
	), $atts ) );
	  
	return '<img class="'.$type.'" src="'.$src.'" title="'.$title.'" alt="'.$alt.'" />';
}

add_shortcode('image', 'image');

function custom_image( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'src' => '',
		'alt' => '',
		'width' => '',
	   'height' => ''
	), $atts ) );
	  
	return '<img src="'.get_bloginfo('template_url').'/scripts/timthumb.php?src='.$src.'&h='.$height.'&w='.$width.'&zc=1" alt="'.$alt.'" title="" />';  

}

add_shortcode('custom_image', 'custom_image');

function quotee( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'author' => ''
	), $atts ) );
	if (!empty($author)){ $author='by '.$author;}
	  
	return '<div class="single-testimonial">
										<img src="'.get_bloginfo('template_directory').'/images/quote.png" alt="" />
										<p class="mt-30">' . do_shortcode($content) .'	</p>
			</div>';
}

add_shortcode('quote', 'quotee');

function team( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'title' => 'meet the team',
		'height' => '300'
	), $atts ) );
   $option_tree='';
	if ( function_exists( 'get_option_tree') ) {
		$option_tree = get_option('option_tree');
	
	 if (get_option_tree( 'our_team')) {
 		    $teamm = get_option_tree( 'our_team', $option_tree, false, true, -1 );
 		    $img_num = 1;
 		    $output='';
 		    if(!empty($teamm)){ 
 		      $output.='<div id="team">';
 		      $output.= '<div class="fl">';
			   $output.= '<div class="verti"><h3 class="fl team-title">'.$title.'</h3><img src="http://trendis.si/wp-themes/in-motion/wp-content/themes/in-motion/images/bracket.png" alt="" class="fl mr72" /></div>';
				$output.= '<div class="horiz"><h3 class="fl team-title">'.$title.'</h3><br/><img src="http://trendis.si/wp-themes/in-motion/wp-content/themes/in-motion/images/bracket-horiz.png" alt="" class="fl mr72" /></div>';
				$output.= '</div>';
			   $output.='<div class="team-imgs fl"><ul class="ul-team">';
			   foreach( $teamm as $member ) {
			   
					$output.='<li class="az">';
					if($member['link'] != '') {
						$output.='<a href="'.$member['link'].'"><img src="'.$member['image'].'" alt="" />'.$member['title'].'</a></li>';
					}
					else {
						$output.='<img src="'.$member['image'].'" alt="" />'.$member['title'].'</li>';
					}			
					
				}
					$output.='</ul></div></div><div class="clearfix"></div>';
			}
		}
	
	return $output;
	}
									
}
add_shortcode('team', 'team');

function short_twitter( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'title' => 'Share this on Twitter!',
		'status' => 'Look at this great post -'
	), $atts ) );
  return '<p><a rel="nofollow" href="http://twitter.com/home?status='.$status.' '.get_permalink($post->ID).'" title="'.$title.'" target="_blank">'.$title.'</a></p>';
}
add_shortcode('tweet', 'short_twitter');

function short_digg( $atts, $content = null  ) {
	extract( shortcode_atts( array(
		'title' => 'Share this on Digg!'
	), $atts ) );
  return '<p><a  rel="nofollow" href="http://digg.com/submit?phase=2&url=<?php the_permalink(); ?>" title="'.$title.'" target="_blank">'.$title.'</a></p>';
}
add_shortcode('diggthis', 'short_digg');

function listt( $atts, $content = null  ) {
		extract( shortcode_atts( array(
		'width' => '450'
	), $atts ) );  
	$return = '<div class="some-list"><ul class="list-1">';
	$return .= do_shortcode($content);
	$return .= '</ul></div>';		
	
	return $return;	
}
add_shortcode('list', 'listt');

function list_li( $atts, $content = null  ) { 
		extract( shortcode_atts( array(
		'url' => '#'
	), $atts ) );  
	$return = '<li><a href="'.$url.'">';
	$return .= do_shortcode($content) ;
	$return .= '</a></li>';		
	
	return $return;	
}
add_shortcode('list_li', 'list_li');

?>