add_action('wp_enqueue_scripts', 'astra_child_enqueue_styles'); // Helper function with caching function get_yahoo_price($symbol) { // Create a unique cache key for each symbol $cache_key = 'yahoo_price_' . md5($symbol); // Try to get cached value $cached_price = get_transient($cache_key); if ($cached_price !== false) { return $cached_price; } // If not cached, fetch from Yahoo Finance $url = "https://query1.finance.yahoo.com/v8/finance/chart/" . urlencode($symbol); $response = wp_remote_get($url); if (is_wp_error($response)) { return "Error fetching data."; } $body = wp_remote_retrieve_body($response); $data = json_decode($body, true); if (!empty($data['chart']['result'][0]['meta']['regularMarketPrice'])) { $price = $data['chart']['result'][0]['meta']['regularMarketPrice']; // Cache the price for 60 seconds (adjust as needed) set_transient($cache_key, $price, 60); return $price; } else { return "Data unavailable."; } } // Shortcodes if (!function_exists('show_sensex')) { function show_sensex() { $price = get_yahoo_price("^BSESN"); return "
Sensex: " . $price . "
"; } add_shortcode('sensex', 'show_sensex'); } if (!function_exists('show_nifty')) { function show_nifty() { $price = get_yahoo_price("^NSEI"); return "
Nifty: " . $price . "
"; } add_shortcode('nifty', 'show_nifty'); } if (!function_exists('show_gold_price')) { function show_gold_price() { $price = get_yahoo_price("GC=F"); return "
Gold Price: " . $price . " USD
"; } add_shortcode('gold_price', 'show_gold_price'); } if (!function_exists('show_silver_price')) { function show_silver_price() { $price = get_yahoo_price("SI=F"); return "
Silver Price: " . $price . " USD
"; } add_shortcode('silver_price', 'show_silver_price'); } // Shortcode: Silver (SI=F) if (!function_exists('show_silver_price')) { function show_silver_price() { $price = get_yahoo_price("SI=F"); return "
Silver Price: " . $price . " USD
"; } add_shortcode('silver_price', 'show_silver_price'); } // Shortcode: Sensex if (!function_exists('show_sensex')) { function show_sensex() { return "
Sensex: 75,000
"; } add_shortcode('sensex', 'show_sensex'); } // Shortcode: Nifty if (!function_exists('show_nifty')) { function show_nifty() { return "
Nifty: 22,500
"; } add_shortcode('nifty', 'show_nifty'); } // Shortcode: Gold Price if (!function_exists('show_gold_price')) { function show_gold_price() { return "
Gold Price: ₹65,000 / 10g
"; } add_shortcode('gold_price', 'show_gold_price'); } // Shortcode: Silver Price if (!function_exists('show_silver_price')) { function show_silver_price() { return "
Silver Price: ₹75 / g
"; } add_shortcode('silver_price', 'show_silver_price'); } // Example shortcode for market data function show_market_data() { return "
Sensex: 75,000 | Nifty: 22,500
"; } add_shortcode('market_data', 'show_market_data'); // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit; // BEGIN ENQUEUE PARENT ACTION // AUTO GENERATED - Do not modify or remove comment markers above or below: if ( !function_exists( 'chld_thm_cfg_locale_css' ) ): function chld_thm_cfg_locale_css( $uri ){ if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) ) $uri = get_template_directory_uri() . '/rtl.css'; return $uri; } endif; add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' ); if ( !function_exists( 'child_theme_configurator_css' ) ): function child_theme_configurator_css() { wp_enqueue_style( 'chld_thm_cfg_child', trailingslashit( get_stylesheet_directory_uri() ) . 'style.css', array( 'astra-theme-css' ) ); } endif; add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 10 ); // END ENQUEUE PARENT ACTION https://livemarkettoday.com/post-type-elementor_library-sitemap-1.xml 2026-04-08T15:45:53+05:30 https://livemarkettoday.com/post-type-page-sitemap-1.xml 2026-04-08T15:45:53+05:30 https://livemarkettoday.com/post-type-post-sitemap-1.xml 2026-04-08T15:45:53+05:30 https://livemarkettoday.com/post-type-sureforms_form-sitemap-1.xml 2026-04-08T15:45:53+05:30 https://livemarkettoday.com/taxonomy-type-category-sitemap-1.xml 2026-04-08T15:45:53+05:30