Changeset 3347699
- Timestamp:
- 08/20/2025 06:11:50 PM (6 months ago)
- Location:
- fitcalc-bmi-calculator/trunk
- Files:
-
- 4 edited
-
css/style.css (modified) (2 diffs)
-
fitcalc.php (modified) (3 diffs)
-
includes/fitcalc-functions.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fitcalc-bmi-calculator/trunk/css/style.css
r3347678 r3347699 1 /* === FitCalc Container === */2 .fitcalc- container{1 /* === FitCalc Container (for current template) === */ 2 .fitcalc-bmi-form { 3 3 max-width: 600px; 4 4 margin: 40px auto; … … 7 7 background: #f9f9f9; 8 8 box-shadow: 0 0 10px rgba(0,0,0,0.1); 9 font-family: 'Segoe UI', sans-serif;9 font-family: 'Segoe UI', Tahoma, Arial, sans-serif; 10 10 } 11 11 12 /* === Headings ===*/13 .fitcalc- title{14 text-align: center;15 f ont-size: 26px;16 margin-bottom: 25px;17 color: #333;12 /* Rows / fields */ 13 .fitcalc-row { 14 display: flex; 15 flex-direction: column; 16 gap: 6px; 17 margin-bottom: 18px; 18 18 } 19 19 20 /* === Form Group === */ 21 .fitcalc-group { 22 margin-bottom: 20px; 23 display: flex; 24 flex-direction: column; 25 } 26 27 /* === Labels and Inputs === */ 28 .fitcalc-group label { 20 .fitcalc-row label { 29 21 font-weight: 600; 30 margin-bottom: 5px;31 22 color: #222; 32 23 } 33 24 34 .fitcalc- groupinput,35 .fitcalc- groupselect {25 .fitcalc-row input, 26 .fitcalc-row select { 36 27 padding: 10px 12px; 37 28 font-size: 16px; 38 border: 1px solid #cc c;29 border: 1px solid #ccd0d4; 39 30 border-radius: 6px; 40 background -color: #fff;41 transition: border 0.3s ease;31 background: #fff; 32 transition: border .25s ease; 42 33 } 43 34 44 .fitcalc- groupinput:focus,45 .fitcalc- groupselect:focus {35 .fitcalc-row input:focus, 36 .fitcalc-row select:focus { 46 37 border-color: #0073aa; 47 38 outline: none; 48 39 } 49 40 50 /* === Button === */ 51 .fitcalc-btn { 41 /* Imperial inline fields (ft + in) */ 42 .fitcalc-inline { 43 display: grid; 44 grid-template-columns: 1fr 1fr; 45 gap: 10px; 46 } 47 48 /* Button */ 49 .fitcalc-actions button { 52 50 background-color: #28a745; 53 color: white;54 font-size: 1 7px;55 font-weight: bold;56 padding: 12px 20px;57 border: none;51 color: #fff; 52 font-size: 16px; 53 font-weight: 700; 54 padding: 12px 18px; 55 border: 0; 58 56 border-radius: 6px; 59 57 cursor: pointer; 60 transition: background-color 0.3s ease;58 transition: background-color .2s ease-in-out; 61 59 } 62 60 63 .fitcalc- btn:hover {61 .fitcalc-actions button:hover { 64 62 background-color: #218838; 65 63 } 66 64 67 /* === Result Box ===*/65 /* Result box */ 68 66 .fitcalc-result { 69 margin-top: 25px; 70 padding: 20px; 71 background-color: #e8f7f0; 67 margin-top: 20px; 68 padding: 16px; 72 69 border-left: 6px solid #28a745; 73 70 border-radius: 6px; 71 background: #e8f7f0; 74 72 color: #333; 75 73 display: none; 76 74 } 77 75 78 .fade-in { 79 animation: fadeIn 0.5s ease-in-out forwards; 76 .fade-in { animation: fitcalcFadeIn .4s ease-out forwards; } 77 78 @keyframes fitcalcFadeIn { 79 from { opacity: 0; transform: translateY(6px); } 80 to { opacity: 1; transform: translateY(0); } 80 81 } 81 82 82 @keyframes fadeIn { 83 from { opacity: 0; transform: translateY(10px); } 84 to { opacity: 1; transform: translateY(0); } 83 /* Category color accents (optional) */ 84 .fitcalc-under { background: #fff7f7; border-left-color: #e55353; } 85 .fitcalc-normal { background: #f3fff6; border-left-color: #28a745; } 86 .fitcalc-over { background: #fffaf0; border-left-color: #ffb84d; } 87 .fitcalc-obese { background: #fff0f0; border-left-color: #ff6b6b; } 88 89 /* Responsive */ 90 @media (max-width: 600px) { 91 .fitcalc-bmi-form { padding: 16px; } 92 .fitcalc-inline { grid-template-columns: 1fr 1fr; gap: 8px; } 85 93 } 86 87 /* === Mobile Friendly === */88 @media (max-width: 600px) {89 .fitcalc-container {90 padding: 15px;91 }92 93 .fitcalc-title {94 font-size: 22px;95 }96 97 .fitcalc-btn {98 font-size: 16px;99 padding: 10px;100 }101 }102 103 .fitcalc-under { background: #fff7f7; }104 .fitcalc-normal { background: #f3fff6; }105 .fitcalc-over { background: #fffaf0; }106 .fitcalc-obese { background: #fff0f0; } -
fitcalc-bmi-calculator/trunk/fitcalc.php
r3347678 r3347699 16 16 17 17 /** 18 * Load text domain 19 * (Urdu: translations load karne ke liye) 18 * Load text domain for translations. 20 19 */ 21 20 add_action('plugins_loaded', function () { 22 load_plugin_textdomain('fitcalc-bmi-calculator', false, dirname(plugin_basename(__FILE__)) . '/languages'); 21 load_plugin_textdomain( 22 'fitcalc-bmi-calculator', 23 false, 24 dirname(plugin_basename(__FILE__)) . '/languages' 25 ); 23 26 }); 24 27 25 28 /** 26 * Enqueue CSS/JS 27 */ 28 function fitcalc_enqueue_assets() { 29 wp_enqueue_style('fitcalc-style', plugin_dir_url(__FILE__) . 'css/style.css', array(), '1.0.0'); 30 wp_enqueue_script('fitcalc-script', plugin_dir_url(__FILE__) . 'js/fitcalc-script.js', array('jquery'), '1.0.0', true); 31 } 32 add_action('wp_enqueue_scripts', 'fitcalc_enqueue_assets'); 33 34 /** 35 * Load core includes 36 */ 37 require_once plugin_dir_path(__FILE__) . 'includes/class-fitcalc.php'; 38 require_once plugin_dir_path(__FILE__) . 'includes/fitcalc-functions.php'; 39 40 /** 41 * Shortcode: [fitcalc_bmi] 29 * Register shortcode: [fitcalc_bmi] 30 * Enqueue CSS/JS only when the shortcode is rendered (perf-friendly). 42 31 */ 43 32 function fitcalc_bmi_shortcode() { 33 // Enqueue assets (versioned to avoid cache issues) 34 wp_enqueue_style( 35 'fitcalc-style', 36 plugin_dir_url(__FILE__) . 'css/style.css', 37 array(), 38 '1.0.7' 39 ); 40 wp_enqueue_script( 41 'fitcalc-script', 42 plugin_dir_url(__FILE__) . 'js/fitcalc-script.js', 43 array(), // no jQuery dependency 44 '1.0.7', 45 true 46 ); 47 48 // Render template 44 49 ob_start(); 45 // Template file46 50 $template = plugin_dir_path(__FILE__) . 'templates/fitcalc-form.php'; 47 if ( file_exists( $template) ) {51 if ( file_exists($template) ) { 48 52 include $template; 49 53 } else { 50 // Fallback message (escaped + translatable)51 54 echo '<p>' . esc_html__( 'FitCalc template not found.', 'fitcalc-bmi-calculator' ) . '</p>'; 52 55 } … … 56 59 57 60 /** 58 * Admin Notice after activate (how to use)61 * One-time admin notice after activation — shows shortcode usage then disappears. 59 62 */ 60 function fitcalc_admin_notice() { 61 echo '<div class="notice notice-success is-dismissible"><p><strong>' . 62 esc_html__( 'FitCalc BMI Calculator:', 'fitcalc-bmi-calculator' ) . 63 '</strong> ' . 64 sprintf( 65 /* translators: %s: shortcode */ 66 esc_html__( 'Use shortcode %s to display the calculator on any page or post.', 'fitcalc-bmi-calculator' ), 67 '<code>[fitcalc_bmi]</code>' 68 ) . 69 '</p></div>'; 63 function fitcalc_set_activation_notice() { 64 set_transient('fitcalc_activation_notice', 1, 30); // 30 seconds is enough for first page load 70 65 } 71 add_action('admin_notices', 'fitcalc_admin_notice'); 66 register_activation_hook(__FILE__, 'fitcalc_set_activation_notice'); 67 68 function fitcalc_show_activation_notice() { 69 if ( get_transient('fitcalc_activation_notice') ) { 70 delete_transient('fitcalc_activation_notice'); 71 echo '<div class="notice notice-success is-dismissible"><p><strong>' . 72 esc_html__( 'FitCalc BMI Calculator', 'fitcalc-bmi-calculator' ) . 73 '</strong> — ' . 74 sprintf( 75 /* translators: %s: shortcode */ 76 esc_html__( 'Use shortcode %s to display the calculator on any page or post.', 'fitcalc-bmi-calculator' ), 77 '<code>[fitcalc_bmi]</code>' 78 ) . 79 '</p></div>'; 80 } 81 } 82 add_action('admin_notices', 'fitcalc_show_activation_notice'); 72 83 73 84 /** 74 * Plugin row meta: show shortcode85 * Plugin row meta: Show shortcode hint under the plugin name on Plugins screen. 75 86 */ 76 87 function fitcalc_plugin_row_meta( $links, $file ) { 77 if ( $file === plugin_basename( __FILE__) ) {88 if ( $file === plugin_basename(__FILE__) ) { 78 89 $links[] = '<span><strong>' . esc_html__( 'Shortcode:', 'fitcalc-bmi-calculator' ) . 79 90 '</strong> <code>[fitcalc_bmi]</code></span>'; … … 82 93 } 83 94 add_filter('plugin_row_meta', 'fitcalc_plugin_row_meta', 10, 2); 95 96 /** 97 * Core includes (keep separate for maintainability). 98 */ 99 require_once plugin_dir_path(__FILE__) . 'includes/class-fitcalc.php'; 100 require_once plugin_dir_path(__FILE__) . 'includes/fitcalc-functions.php'; -
fitcalc-bmi-calculator/trunk/includes/fitcalc-functions.php
r3347678 r3347699 19 19 */ 20 20 function fitcalc_get_plugin_version() { 21 return '1.0. 0';21 return '1.0.7'; 22 22 } 23 23 -
fitcalc-bmi-calculator/trunk/readme.txt
r3347678 r3347699 1 === FitCalc -BMI Calculator ===1 === FitCalc – BMI Calculator === 2 2 Contributors: adnanthemes 3 3 Tags: bmi, calculator, health, fitness, responsive … … 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 Fitcalc is an responsible BMI calculator plugin that supports metric and imperial units. Health, fitness and weight tracking websites designed. Just add shortcode [fitcalc_bmi] to any page or post.11 10 12 == details == 13 Fitcalc is a light BMI calculator plugin designed for WordPress websites. Easily embedded via shortcode, it provides immediate BMI calculations and classification with support for both metric (cm/kg) and Imperial (ft/lbs) units. 11 Lightweight and responsive BMI Calculator plugin for WordPress. Supports both Metric (cm/kg) and Imperial (ft/lbs) units. Easily embed using shortcode [fitcalc_bmi]. 14 12 15 == Establishment==16 1. Upload plugin files to '/WP-content/plugins/fitcalc' directory. 17 2. Activate the plugin through the 'plugins' menu in WordPress. 18 3. Use shortcode `[fitcalc_bmi]` in any post or page. 13 == Description == 14 FitCalc is a lightweight and responsive Body Mass Index (BMI) calculator plugin for WordPress websites. 15 It allows visitors to quickly calculate their BMI using either Metric (cm/kg) or Imperial (ft/lbs) units. 16 The plugin instantly displays the BMI value along with its classification (e.g., underweight, normal, overweight, obese). 19 17 18 **Features:** 19 * Simple shortcode `[fitcalc_bmi]` 20 * Supports Metric and Imperial units 21 * Responsive design 22 * Quick BMI classification 23 24 == Installation == 25 1. Upload the plugin files to the `/wp-content/plugins/fitcalc` directory, or install the plugin directly from the WordPress plugins screen. 26 2. Activate the plugin through the 'Plugins' screen in WordPress. 27 3. Add the shortcode `[fitcalc_bmi]` to any post or page where you want the calculator to appear. 28 29 == Frequently Asked Questions == 30 = How do I display the calculator? = 31 Use the shortcode `[fitcalc_bmi]` inside any post or page. 32 33 = Does it support both metric and imperial? = 34 Yes, users can switch between metric (cm/kg) and imperial (ft/lbs). 35 36 == Screenshots == 37 1. BMI calculator form in metric units 38 2. BMI calculator form in imperial units 39 3. BMI result display with classification 20 40 21 41 == Changelog == 22 42 = 1.0.7 = 23 * Early release of FitCalc - BMI calculator plugin. 43 * First release of FitCalc BMI Calculator plugin. 44 45 == Upgrade Notice == 46 = 1.0.7 = 47 Initial stable release. Upgrade for responsive BMI calculation.
Note: See TracChangeset
for help on using the changeset viewer.