kalponikoronno

if else elseif shortcode

Jan 1st, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1.  
  2. function single_stat_shortcode( $atts, $content = null  ) {
  3.     extract( shortcode_atts( array(
  4.         'title' => '',
  5.         'icon' => '',
  6.         'amount' => '',
  7.         'border' => 'statsec'
  8.     ), $atts ) );
  9.  
  10.     $list .='<div class="col-md-2 col-sm-4 col-xs-6 '.$border.'"> ';
  11. if($icon) :
  12.     $list .='<i class="fa fa-'.$icon.' staticon"></i> ';
  13. elseif($amount) :
  14.     $list .='<h3 class="statamnt">'.$amount.'</h3> ';
  15. else :
  16.     $list .='No icon ';
  17. endif; 
  18.  
  19.  
  20.            
  21.     $list .='<h5>'.$title.'</h5> ';
  22.            
  23.     $list .='</div>';
  24.    
  25.    
  26.     return $list;
  27. }  
  28. add_shortcode('singlestat', 'single_stat_shortcode');
Advertisement
Add Comment
Please, Sign In to add comment