wp/wp-content/themes/IN-MOTION-package-u1/in-motion/functions/shortcodes.php
changeset 0 d970ebf37754
child 1 f6eb5a861d2f
equal deleted inserted replaced
-1:000000000000 0:d970ebf37754
       
     1 <?php
       
     2 
       
     3 //heading shortcodes
       
     4 $return='';
       
     5 
       
     6 function heading1( $atts, $content = null ) {
       
     7    return '<h1>' . do_shortcode($content) . '</h1>';
       
     8 }
       
     9 add_shortcode('h1', 'heading1');
       
    10 
       
    11 function clear( $atts, $content = null ) {
       
    12    return '<div class="clearfix"></div>';
       
    13 }
       
    14 add_shortcode('clear', 'clear');
       
    15 
       
    16 function heading2( $atts, $content = null ) {
       
    17    return '<h2>' . do_shortcode($content) . '</h2>';
       
    18 }
       
    19 add_shortcode('h2', 'heading2');
       
    20 
       
    21 function heading3( $atts, $content = null ) {
       
    22 	$return = '<h3>';
       
    23 	$return .= do_shortcode($content);
       
    24     $return .= '</h3>';
       
    25 	return $return;
       
    26 }
       
    27 add_shortcode('h3', 'heading3');
       
    28 
       
    29 function heading4( $atts, $content = null ) {
       
    30    return '<h4>' . do_shortcode($content) . '</h4>';
       
    31 }
       
    32 add_shortcode('h4', 'heading4');
       
    33 
       
    34 function alignment( $atts, $content = null  ) {
       
    35 		extract( shortcode_atts( array(
       
    36 		'alignment' => 'center'
       
    37 	), $atts ) );  
       
    38 	return '<div style="text-align:'.$alignment.';">'. do_shortcode($content) .'</div>';
       
    39 	 	
       
    40 }
       
    41 add_shortcode('alignment', 'alignment');
       
    42 
       
    43 
       
    44 function seperator( $atts, $content = null ) {
       
    45    return '<div class="seperator" class="seperatorExtra"></div>';
       
    46 }
       
    47 add_shortcode('seperator', 'seperator');
       
    48 
       
    49 function para( $atts, $content = null ) {
       
    50    return '<p>' . do_shortcode($content) . '</p>';
       
    51 }
       
    52 add_shortcode('p', 'para');
       
    53 
       
    54 //layout shortcodes
       
    55 function one_half( $atts, $content = null ) {
       
    56    	$return = '<div  class="one-half">';
       
    57 	$return .= do_shortcode($content);
       
    58     $return .= '</div>';
       
    59 	return $return;
       
    60 }
       
    61 add_shortcode('one_half', 'one_half');
       
    62 
       
    63 
       
    64 function one_half_last( $atts, $content = null ) {
       
    65     $return = '<div  class="one-half-last">';
       
    66 	$return .= do_shortcode($content);
       
    67     $return .= '</div><div class="clearfix"></div>';
       
    68 	return $return;
       
    69  }
       
    70 add_shortcode('one_half_last', 'one_half_last');
       
    71 
       
    72 
       
    73 function one_third ( $atts, $content = null ) {
       
    74 	$return = '<div  class="one-third">';
       
    75 	$return .= do_shortcode($content);
       
    76     $return .= '</div>';
       
    77 	return $return;
       
    78 }
       
    79 add_shortcode('one_third', 'one_third');
       
    80 
       
    81 
       
    82 function one_third_last( $atts, $content = null ) {
       
    83 	$return = '<div  class="one-third last-column">';
       
    84 	$return .= do_shortcode($content);
       
    85     $return .= '</div><div class="clearfix"></div>';
       
    86 	return $return;
       
    87 }
       
    88 add_shortcode('one_third_last', 'one_third_last');
       
    89 
       
    90 function one_fourth ( $atts, $content = null ) {
       
    91    	$return = '<div  class="one-fourth">';
       
    92 	$return .= do_shortcode($content);
       
    93     $return .= '</div>';
       
    94 	return $return;
       
    95    
       
    96 }
       
    97 add_shortcode('one_fourth', 'one_fourth');
       
    98 
       
    99 
       
   100 function one_fourth_last( $atts, $content = null ) {
       
   101     $return = '<div  class="one-fourth last-column">';
       
   102 	$return .= do_shortcode($content);
       
   103     $return .= '</div><div class="clearfix"></div>';
       
   104 	return $return;
       
   105    }
       
   106 add_shortcode('one_fourth_last', 'one_fourth_last');
       
   107 
       
   108 function two_third ( $atts, $content = null ) {
       
   109     $return = '<div  class="two-third">';
       
   110 	$return .= do_shortcode($content);
       
   111     $return .= '</div>';
       
   112 	return $return;
       
   113 }
       
   114 add_shortcode('two_third', 'two_third');
       
   115 
       
   116 
       
   117 function two_third_last( $atts, $content = null ) {
       
   118 	$return = '<div  class="one-third last-column">';
       
   119 	$return .= do_shortcode($content);
       
   120     $return .= '</div><div class="clearfix"></div>';
       
   121 	return $return;
       
   122 }
       
   123 add_shortcode('two_third_last', 'two_third_last');
       
   124 
       
   125 function three_fourth ( $atts, $content = null ) {
       
   126    return '<div  class="three-fourth">' . do_shortcode($content) . '</div>';
       
   127 }
       
   128 add_shortcode('three_fourth', 'three_fourth');
       
   129 
       
   130 
       
   131 function three_fourth_last( $atts, $content = null ) {
       
   132    return '<div  class="three-fourth-last last-column">' . do_shortcode($content) . '</div><div class="clearfix"></div>';
       
   133 }
       
   134 add_shortcode('three_fourth_last', 'three_fourth_last');
       
   135 
       
   136 
       
   137 //buttons
       
   138 
       
   139 function button( $atts, $content = null  ) {
       
   140 	extract( shortcode_atts( array(
       
   141 		'url' => '#',
       
   142 		'color' => 'black',
       
   143 		'type' => 'small'
       
   144 	), $atts ) );
       
   145 
       
   146 	  
       
   147 	return '<div class="button"><a class="'.$type.'" href="'.$url.'">' . do_shortcode($content) . '</a></div>';
       
   148 }
       
   149 
       
   150 add_shortcode('button', 'button');
       
   151 
       
   152 
       
   153 function highlight( $atts, $content = null  ) {
       
   154 	extract( shortcode_atts( array(
       
   155 		'color' => ''
       
   156 	), $atts ) );
       
   157 	$return = '<span class="hl '.$color.'"> ';
       
   158 	$return .= do_shortcode($content);
       
   159     $return .= ' </span>';
       
   160 	return $return;
       
   161 }
       
   162 
       
   163 add_shortcode('hl', 'highlight');
       
   164 
       
   165 function highlight_main( $atts, $content = null  ) {
       
   166 	extract( shortcode_atts( array(
       
   167 		'color' => ''
       
   168 	), $atts ) );
       
   169 	  
       
   170 	return '<span class="hl-main"> ' . do_shortcode($content) .' </span>';
       
   171 }
       
   172 
       
   173 add_shortcode('main-hl', 'highlight_main');
       
   174 
       
   175 
       
   176 
       
   177 function youtube_video( $atts, $content = null  ) {
       
   178 	extract( shortcode_atts( array(
       
   179 		'id' => '',
       
   180 		'width' => '560',
       
   181 		'height' => '315'
       
   182 	), $atts ) );
       
   183 	  
       
   184 	return '<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/'.$id.'" frameborder="0" allowfullscreen></iframe>';
       
   185 }
       
   186 
       
   187 add_shortcode('youtube', 'youtube_video');
       
   188 
       
   189 
       
   190 function vimeo_video( $atts, $content = null  ) {
       
   191 	extract( shortcode_atts( array(
       
   192 		'id' => '',
       
   193 		'width' => '560',
       
   194 		'height' => '315'
       
   195 	), $atts ) );
       
   196 	  
       
   197 	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>';
       
   198 }
       
   199 
       
   200 add_shortcode('vimeo', 'vimeo_video');
       
   201 
       
   202 
       
   203 function image( $atts, $content = null  ) {
       
   204 	extract( shortcode_atts( array(
       
   205 		'type' => '',
       
   206 		'src' => '',
       
   207 		'title' => '',
       
   208 		'alt' => '',
       
   209 	), $atts ) );
       
   210 	  
       
   211 	return '<img class="'.$type.'" src="'.$src.'" title="'.$title.'" alt="'.$alt.'" />';
       
   212 }
       
   213 
       
   214 add_shortcode('image', 'image');
       
   215 
       
   216 function custom_image( $atts, $content = null  ) {
       
   217 	extract( shortcode_atts( array(
       
   218 		'src' => '',
       
   219 		'alt' => '',
       
   220 		'width' => '',
       
   221 	   'height' => ''
       
   222 	), $atts ) );
       
   223 	  
       
   224 	return '<img src="'.get_bloginfo('template_url').'/scripts/timthumb.php?src='.$src.'&h='.$height.'&w='.$width.'&zc=1" alt="'.$alt.'" title="" />';  
       
   225 
       
   226 }
       
   227 
       
   228 add_shortcode('custom_image', 'custom_image');
       
   229 
       
   230 function quotee( $atts, $content = null  ) {
       
   231 	extract( shortcode_atts( array(
       
   232 		'author' => ''
       
   233 	), $atts ) );
       
   234 	if (!empty($author)){ $author='by '.$author;}
       
   235 	  
       
   236 	return '<div class="single-testimonial">
       
   237 										<img src="'.get_bloginfo('template_directory').'/images/quote.png" alt="" />
       
   238 										<p class="mt-30">' . do_shortcode($content) .'	</p>
       
   239 			</div>';
       
   240 }
       
   241 
       
   242 add_shortcode('quote', 'quotee');
       
   243 
       
   244 function team( $atts, $content = null  ) {
       
   245 	extract( shortcode_atts( array(
       
   246 		'title' => 'meet the team',
       
   247 		'height' => '300'
       
   248 	), $atts ) );
       
   249    $option_tree='';
       
   250 	if ( function_exists( 'get_option_tree') ) {
       
   251 		$option_tree = get_option('option_tree');
       
   252 	
       
   253 	 if (get_option_tree( 'our_team')) {
       
   254  		    $teamm = get_option_tree( 'our_team', $option_tree, false, true, -1 );
       
   255  		    $img_num = 1;
       
   256  		    $output='';
       
   257  		    if(!empty($teamm)){ 
       
   258  		      $output.='<div id="team">';
       
   259  		      $output.= '<div class="fl">';
       
   260 			   $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>';
       
   261 				$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>';
       
   262 				$output.= '</div>';
       
   263 			   $output.='<div class="team-imgs fl"><ul class="ul-team">';
       
   264 			   foreach( $teamm as $member ) {
       
   265 			   
       
   266 					$output.='<li class="az">';
       
   267 					if($member['link'] != '') {
       
   268 						$output.='<a href="'.$member['link'].'"><img src="'.$member['image'].'" alt="" />'.$member['title'].'</a></li>';
       
   269 					}
       
   270 					else {
       
   271 						$output.='<img src="'.$member['image'].'" alt="" />'.$member['title'].'</li>';
       
   272 					}			
       
   273 					
       
   274 				}
       
   275 					$output.='</ul></div></div><div class="clearfix"></div>';
       
   276 			}
       
   277 		}
       
   278 	
       
   279 	return $output;
       
   280 	}
       
   281 									
       
   282 }
       
   283 add_shortcode('team', 'team');
       
   284 
       
   285 function short_twitter( $atts, $content = null  ) {
       
   286 	extract( shortcode_atts( array(
       
   287 		'title' => 'Share this on Twitter!',
       
   288 		'status' => 'Look at this great post -'
       
   289 	), $atts ) );
       
   290   return '<p><a rel="nofollow" href="http://twitter.com/home?status='.$status.' '.get_permalink($post->ID).'" title="'.$title.'" target="_blank">'.$title.'</a></p>';
       
   291 }
       
   292 add_shortcode('tweet', 'short_twitter');
       
   293 
       
   294 function short_digg( $atts, $content = null  ) {
       
   295 	extract( shortcode_atts( array(
       
   296 		'title' => 'Share this on Digg!'
       
   297 	), $atts ) );
       
   298   return '<p><a  rel="nofollow" href="http://digg.com/submit?phase=2&url=<?php the_permalink(); ?>" title="'.$title.'" target="_blank">'.$title.'</a></p>';
       
   299 }
       
   300 add_shortcode('diggthis', 'short_digg');
       
   301 
       
   302 function listt( $atts, $content = null  ) {
       
   303 		extract( shortcode_atts( array(
       
   304 		'width' => '450'
       
   305 	), $atts ) );  
       
   306 	$return = '<div class="some-list"><ul class="list-1">';
       
   307 	$return .= do_shortcode($content);
       
   308 	$return .= '</ul></div>';		
       
   309 	
       
   310 	return $return;	
       
   311 }
       
   312 add_shortcode('list', 'listt');
       
   313 
       
   314 function list_li( $atts, $content = null  ) { 
       
   315 		extract( shortcode_atts( array(
       
   316 		'url' => '#'
       
   317 	), $atts ) );  
       
   318 	$return = '<li><a href="'.$url.'">';
       
   319 	$return .= do_shortcode($content) ;
       
   320 	$return .= '</a></li>';		
       
   321 	
       
   322 	return $return;	
       
   323 }
       
   324 add_shortcode('list_li', 'list_li');
       
   325 
       
   326 ?>