How to access CryptoWP data in custom templates

The real power of CryptoWP comes when working in custom templates. With access to raw coin data, you can create just about anything, including price calculators, and custom price tickers.

CryptoWP stores all coin data in a single option in the WordPress Options table. In your theme or plugin, you can refer to the handy cryptowp_data() function to display a list of your coin data in templates:

<?php $coin_data = cryptowp_data(); ?>

Example output:

Array (
	[currency] =>
	[currency_sign] =>
	[coins] => Array (
		[bitcoin] => Array (
			[name] => Bitcoin
			[icon] => https://domain.com/wp-content/uploads/2017/09/bitcoin.png
			[id] => bitcoin
			[symbol] => BTC
			[percent] => -5.49
			[price] => 12,937.30
			[value] => decrease
			[price_btc] => 1.0
			[supply] => 16773187.0
			[market_cap] => 216999752175
			[error] =>
			[sign] =>
			[percent_change_1h] => -2.85
			[percent_change_24h] => -5.49
		)
		[ethereum] => Array (
			[name] => Ethereum
			[icon] => https://domain.com/wp-content/uploads/2017/08/ethereum.png
			[id] => ethereum
			[symbol] => ETH
			[percent] => 0.45
			[price] => 715.74
			[value] => increase
			[price_btc] => 0.0556923
			[supply] => 96677516.0
			[market_cap] => 69196255535.0
			[error] =>
			[sign] =>
			[percent_change_1h] => -1.49
			[percent_change_24h] => 0.45
		)
		[...]
	)
)

You can transverse through the array by storing the function in a variable (like above) and accessing any coin with the array keys you want like so:

<?php echo $coin_data['coins']['bitcoin']['price']; ?>
<?php echo $coin_data['coins']['ethereum']['market_cap']; ?>