maximus87

BMI calculator

Feb 27th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.84 KB | None | 0 0
  1. /********************************/
  2. /* New changes for optimisation */
  3. /********************************/
  4.  
  5.  
  6. add_shortcode( 'wpc-bmi', 'wpc_bmi' );
  7. function wpc_bmi( $atts, $content )
  8. {
  9.     ob_start();
  10.     ?>
  11. <div class="bmi-calc clearfix <?php echo $atts['class']; ?>" data-type="system-normal">
  12.  
  13.     <?php if( !empty($atts['title']) ) : ?>
  14.         <h3 class="bmi-calc-title"><?php echo $atts['title']; ?></h3>
  15.     <?php endif; ?>
  16.  
  17.     <div class='bmi-system system-normal'>
  18.         <div class="field-text">
  19.             <label for="bmi_height1"><?php _e('My height is', 'fw'); ?> </label>
  20.             <input type="text" name="bmi_height1" value="" id="bmi_height1" placeholder="5">
  21.             <label><?php _e('feet ' ,''); ?></label>
  22.             <input type="text" name="bmi_height3" value="" id="bmi_height3" placeholder="10">
  23.             <label><?php _e('inches and' ,''); ?></label>
  24.         </div>
  25.  
  26.         <div class="field-text">
  27.             <label for="bmi_weight1"><?php _e('I weight', 'fw'); ?> </label>
  28.             <input type="text" name="bmi_weight1" value="" id="bmi_weight1" placeholder="150">
  29.             <label><?php _e('pounds', 'fw'); ?></label>
  30.         </div>
  31.         <div class='clearfix'></div>
  32.         <a class='switch' href='#'><?php _e('Switch to Metric', 'fw'); ?></a>
  33.     </div>
  34.  
  35.     <div class='bmi-system system-metric hidden'>
  36.         <div class="field-text">
  37.             <label for="bmi_height2"><?php _e('My height is', 'fw'); ?> </label>
  38.             <input type="text" name="bmi_height2" value="" id="bmi_height2" placeholder="180">
  39.             <label><?php _e('CM and', 'fw'); ?></label>
  40.         </div>
  41.  
  42.         <div class="field-text">
  43.             <label for="bmi_weight2"><?php _e('I weight', ''); ?></label>
  44.             <input type="text" name="bmi_weight2" value="" id="bmi_weight2" placeholder="80">
  45.             <label><?php _e('KG', 'fw'); ?></label>
  46.         </div>
  47.  
  48.         <div class='clearfix'></div>
  49.         <a class='switch' href='#'><?php _e('Switch to Standard', 'fw'); ?></a>
  50.     </div>
  51.  
  52.     <div class='bmi-results clearfix exceed hidden'>
  53.         <div class="bmi-result">
  54.             <i class="mbc-icon"></i> <?php _e('Your BMI is', 'fw'); ?> <span id='bmi-result'>39.2</span>
  55.         </div>
  56.  
  57.         <ul>
  58.             <li><span>&lt; 18.5</span> <?php _e('Underweight', 'fw'); ?></li>
  59.             <li class="normal"><span>18.5 - 24.9</span> <?php _e('Good', 'fw'); ?></li>
  60.             <li><span>25.0 - 29.9</span> <?php _e('Overweight', 'fw'); ?></li>
  61.             <li class="bad"><span>30.0 +</span> <?php _e('Obese', 'fw'); ?></li>
  62.         </ul>
  63.  
  64.     </div>
  65.  
  66.     <div class="bmi-buttons">
  67.         <a href='#' id='bmi-submit' class='btn btn-sm btn-blue'><span><?php _e('Calculate your BMI', 'fw'); ?></span></a>
  68.         <a href='#' id='bmi-reset' class='btn btn-sm btn-blue hidden'><span><?php _e('Reset', 'fw'); ?></span></a>
  69.         <a href="http://www.staging1.mexicobariatriccenter.com/contact/" id='bmi-schedule' class="btn btn-sm btn-red hidden"><?php _e('Schedule an appointment with us', 'fw'); ?></a>
  70.     </div>
  71. </div>
  72. <?php $myvariable = ob_get_clean();
  73.     return $myvariable;
  74. }
Add Comment
Please, Sign In to add comment