300)) { $ticker = wp_remote_get("https://api.coinmarketcap.com/v2/ticker/?convert=EUR&limit=10"); $actual_data = json_decode($ticker['body'], true); array_push($actual_data, array('date_time' => $current_date)); file_put_contents($file_cache, json_encode($actual_data)); } $cryptocurrency = 1; //Get id Cryptocurrency. Default Bitcoin. switch ($atts["cryptocurrency"]) { case 'Bitcoin': $cryptocurrency = 1; break; case 'Ethereum': $cryptocurrency = 1027; break; case 'XRP': $cryptocurrency = 52; break; case 'Bitcoin_Cash': $cryptocurrency = 1831; break; case 'EOS': $cryptocurrency = 1765; break; case 'Stellar': $cryptocurrency = 512; break; case 'Litecoin': $cryptocurrency = 2; break; case 'Cardano': $cryptocurrency = 2010; break; case 'Tether': $cryptocurrency = 825; break; case 'Monero': $cryptocurrency = 328; break; } //Set rounding variable. Default 4. if (isset($atts["rounding"])) { $rounding = $atts["rounding"]; } else { $rounding = 4; } $show = ''.esc_html($atts["cryptocurrency"]).' = '.esc_html(round($actual_data["data"][$cryptocurrency]["quotes"][$atts["val"]]["price"], $rounding)).' '.esc_html($atts["val"]).''; return $show; }