Author

Topic: Displaying the current Bitcoin price (Read 243 times)

legendary
Activity: 2758
Merit: 6830
April 18, 2018, 03:30:30 PM
#9
In this case, you are loading the price.php page into your iframe. So, the price will be printed in the price.php and shown in the page where you set the iframe code.
copper member
Activity: 2940
Merit: 4101
Top Crypto Casino
April 18, 2018, 03:13:34 PM
#8
Yeah, thanks buddy
Actually, both solutions will work. The first is the fastest I can include it in the theme, but I don't want to edit it as I am already facing a problem with it lol
The second one seems to be the best for my case, however, in


a PHP code can be included with   Huh
legendary
Activity: 2758
Merit: 6830
April 17, 2018, 06:16:41 PM
#7
Can you add your own PHP code inside the page?

If so, you could do something like this:

Code:
  $url "https://api.coinmarketcap.com/v1/ticker/bitcoin/?convert=USD";

  
$json file_get_contents($url);
  
$data json_decode($jsonTRUE);

  
$btc_last  $data[0]["price_usd"];
?>



      
  • Price: $echo $btc_last ?>



or if you can't, create a file called "price.php" or whatever with the same code and add something like this to your page:
Code:

or if you want to load it with Javascript and JQuery:

If you are not already using jquery in your page, add this to your tag:
Code:

And do something like this:
Code:


copper member
Activity: 2940
Merit: 4101
Top Crypto Casino
April 17, 2018, 03:14:09 PM
#6
Thanks for your offer but I prefer doing it myself as I am sure it isn't difficult. I don't want to use a plugin based solution as the WP installation I already overloaded with plugins which I usually don't like to have
sr. member
Activity: 501
Merit: 252
April 14, 2018, 09:53:26 PM
#5
If you want custom based then i can code for you in PHP which u can display anywhere u like

Or you can use readymade

https://wordpress.org/plugins/cryptocurrency-price-ticker-widget/

The keyword for search is Bitcoin Ticker or Cryptocurrency Ticker for wordpress.

https://wordpress.org/plugins/search/bitcoin-ticker-widget/
copper member
Activity: 2940
Merit: 4101
Top Crypto Casino
April 14, 2018, 04:08:38 PM
#4
Thanks dude. Yes, I can use PHP, so basically I create the file and just copy paste any API code inside and save? It's easy so, my only problem then is how to display it? is it what am I supposed to use on a page then?
https://www.google.com/search?q=how+to+call+a+php+function&oq=how+to+call+a+php+function&aqs=chrome..69i57j0l5.10327j0j7&sourceid=chrome&ie=UTF-8

through an iframe It didn't work but I think now I was using the URL and not an API code lol
legendary
Activity: 2758
Merit: 6830
April 14, 2018, 03:39:16 PM
#3
I'm not aware on how Wordpress works, but can you create a .PHP file and and host it in your website? You could create a .php file to parse out the price from an exchange/coinmarketcap/bitcoinaverage API and show it in your page (directly or through an iframe).
copper member
Activity: 2940
Merit: 4101
Top Crypto Casino
April 14, 2018, 03:22:54 PM
#2
Anyone?  Huh
copper member
Activity: 2940
Merit: 4101
Top Crypto Casino
April 11, 2018, 12:29:15 PM
#1
I need to install a code displaying the current Bitcoin price (and in future some other data related to Bitcoin)
I am using a WordPress installation.

So you may think, why not using the ready-made widgets such as coincompare bitcoinaverage and alike websites? I can't because they are branded (powered by.) And I can't use such method.

So then, why not to use APIs you say? Here is my problem:

How the fuck am I supposed to use the APIs?
I tried with different tags such as and even I tried in a plain text (<==  Cheesy Yes I know)

Using a search engine is not so useful, I mainly find links related to the WordPress API, not how to use APIs with WP.
I wasted 2 hours searching for something that I know it's easy to do (once you know how)

Thank you Cry
Jump to: