Pages:
Author

Topic: Easy Wordpress Bitcoin Price Widget Using PHP Script (Read 9357 times)

full member
Activity: 191
Merit: 100
Can anyone replace Mt Gox with another on this? Mt Gox is dead. Maybe Blockchain or something. I'm using this on my site http://www.bitcoinvalues.net but the prices are useless now cause Mt. Gox no longer exist.
legendary
Activity: 1358
Merit: 1002
Can anyone tell me how to display latest prices for the top currencies in that one script like USD, CAD, Pounds, UR without having to have many copies of the script?

I think you will need one curl call for each currency, which can get pretty taxing on your server if you get the tickers on each page load.
Unless you can find a ticker which displays all currencies using one call only, ofcourse.

EDIT: Found it: https://api.bitcoinaverage.com/ticker/global/all

Tell me which currencies you want and which value(s) to show for each currency and I'll see what I can do about it if you can't do it yourself.
full member
Activity: 191
Merit: 100
Can anyone tell me how to display latest prices for the top currencies in that one script like USD, CAD, Pounds, UR without having to have many copies of the script?
newbie
Activity: 30
Merit: 0
Thanks for all your early work in getting these widgets out there. We are in the process of releasing a suite of Bitcoin Plugins for WordPress and will definitely consider learnings from these earlier plugins in our best practices. Also just sent out a couple of tips Smiley
sr. member
Activity: 300
Merit: 250
aah thanks Smiley
legendary
Activity: 1358
Merit: 1002
does anyone know a ticker for the bitcoin prices in Euro?

Greets!

Replace the URL with https://mtgox.com/api/0/data/ticker.php?Currency=EUR

Or just append
Code:
?Currency=EUR
to the one that's already there.
sr. member
Activity: 300
Merit: 250
does anyone know a ticker for the bitcoin prices in Euro?

Greets!
jr. member
Activity: 39
Merit: 1
This doesn't work on wordpress.com sites but the only thing that shows is the BTC address and text message,the php widget does not show.Just for those who use wordpress.com blogs.Seems that wordpress.com doesn't allow anything other than basic html on their site.

Yeah I was afraid of that.

Wordpress.com does block all scripting, to the point where you can't even embed video using standard embed code.  They will allow Youtube shortcode embeds, but that's about it.  The lack of script embedding on Wordpress.com is why I dumped that host for my own standalone in the first place.

legendary
Activity: 1022
Merit: 1000
Freelance videographer
This doesn't work on wordpress.com sites but the only thing that shows is the BTC address and text message,the php widget does not show.Just for those who use wordpress.com blogs.Seems that wordpress.com doesn't allow anything other than basic html on their site.
legendary
Activity: 1358
Merit: 1002
I just inserted your code in a plugin so it would be easier to add the widget and gave you credit for it.

For caching people should use http://wordpress.org/extend/plugins/wp-widget-cache/ which will add options to set a timed cache to each widget individually. WP Widget Cache is not to replace the WP-Cache or WP Super Cache, it’s a plus for them. In the case of a high traffic site that should be already covered but it's a good thing you brought the subject up to the conversation.
jr. member
Activity: 39
Merit: 1
Plugin based widget for wordpress.
Just activate the plugin and you'll have the Bitcoin price Widget on your widget administration screen, ready to add to a sidebar of your choice.

It's a little bit rough still, with no options to edit, but I'll probably change that in a couple days. It only took like 5 minutes to put this together.

Download here:
Clicky Clicky

Thanks psy.

This widget is basically just a rehash of the code I presented at the top of the page though, only you can't edit the way the info is displayed without editing the file.  Not that I don't appreciate you putting it into a widget file format though.

It would be nice to see a widget that incorporates caching and short code tags for the display of variables.  Perhaps a customizable CSS as well.
hero member
Activity: 548
Merit: 502
So much code.
Plugin based widget for wordpress.
Just activate the plugin and you'll have the Bitcoin price Widget on your widget administration screen, ready to add to a sidebar of your choice.

It's a little bit rough still, with no options to edit, but I'll probably change that in a couple days. It only took like 5 minutes to put this together.

Download here:
Clicky Clicky

Would you look at that!
legendary
Activity: 1358
Merit: 1002
Plugin based widget for wordpress.
Just activate the plugin and you'll have the Bitcoin price Widget on your widget administration screen, ready to add to a sidebar of your choice.

It's a little bit rough still, with no options to edit, but I'll probably change that in a couple days. It only took like 5 minutes to put this together.

Download here:
Clicky Clicky
hero member
Activity: 714
Merit: 500
thanks.
hero member
Activity: 548
Merit: 502
So much code.
That would be even more ideal hahah.

Unfortunately my code expertise does not lie with PHP, but rather .Net, so I'm not well suited to undertake such a task.

Perhaps someday I'll get around to learning the language and putting together a nice package like that.  It would be nice if some pro-php people got around to this though.  There's a lot of e-commerce and informational sites that could benefit from such a suite of Wordpress plugins.

Should we set up a bounty?
jr. member
Activity: 39
Merit: 1
That's a good idea, but more work than I'm willing to put into it at the moment.

I suppose we can just leave this "as is" for low to medium traffic blogs, but it is worth noting that high traffic sites should cache these results.

If someone updates the code snippet to cache against a MySQL database, I'll update the OP to include install instructions and the relevant code.  Ideally this code should be wrapped in its own Wordpress widget and the MySQL script to setup the database cache should be set to install automatically with the install of the Widget from inside Wordpress, with the return variables from Mt. Gox being accessible by short code in the widget text field.  This way people who have no technical knowledge would still be able to easily install the script.

It might be worthwhile to not even limit the short code variable results to a widget, but rather make them accessible from anywhere on the site, such as in headers, footers or post content.

It sounds like *somebody* needs to put together a suite of Wordpress plugins for various Bitcoin economic parameters: difficulty, # blocks, market cap, ticker.

That would be even more ideal hahah.

Unfortunately my code expertise does not lie with PHP, but rather .Net, so I'm not well suited to undertake such a task.

Perhaps someday I'll get around to learning the language and putting together a nice package like that.  It would be nice if some pro-php people got around to this though.  There's a lot of e-commerce and informational sites that could benefit from such a suite of Wordpress plugins.
hero member
Activity: 548
Merit: 502
So much code.
That's a good idea, but more work than I'm willing to put into it at the moment.

I suppose we can just leave this "as is" for low to medium traffic blogs, but it is worth noting that high traffic sites should cache these results.

If someone updates the code snippet to cache against a MySQL database, I'll update the OP to include install instructions and the relevant code.  Ideally this code should be wrapped in its own Wordpress widget and the MySQL script to setup the database cache should be set to install automatically with the install of the Widget from inside Wordpress, with the return variables from Mt. Gox being accessible by short code in the widget text field.  This way people who have no technical knowledge would still be able to easily install the script.

It might be worthwhile to not even limit the short code variable results to a widget, but rather make them accessible from anywhere on the site, such as in headers, footers or post content.

It sounds like *somebody* needs to put together a suite of Wordpress plugins for various Bitcoin economic parameters: difficulty, # blocks, market cap, ticker.
jr. member
Activity: 39
Merit: 1
I would cache this result with a timeout of a minute or so. You might even make it do an AJAX callback so your page loads faster.

Caching is needed because if you get visitors more often than every 10 seconds, then MtGox might start throttling/blocking you.

You need to do it asynchronously so that every page load doesn't have to talk to MtGox's server before delivering the final page to the user.

That's a good idea, but more work than I'm willing to put into it at the moment.

I suppose we can just leave this "as is" for low to medium traffic blogs, but it is worth noting that high traffic sites should cache these results.

If someone updates the code snippet to cache against a MySQL database, I'll update the OP to include install instructions and the relevant code.  Ideally this code should be wrapped in its own Wordpress widget and the MySQL script to setup the database cache should be set to install automatically with the install of the Widget from inside Wordpress, with the return variables from Mt. Gox being accessible by short code in the widget text field.  This way people who have no technical knowledge would still be able to easily install the script.

It might be worthwhile to not even limit the short code variable results to a widget, but rather make them accessible from anywhere on the site, such as in headers, footers or post content.
hero member
Activity: 548
Merit: 502
So much code.
I would cache this result with a timeout of a minute or so. You might even make it do an AJAX callback so your page loads faster.

Caching is needed because if you get visitors more often than every 10 seconds, then MtGox might start throttling/blocking you.

You need to do it asynchronously so that every page load doesn't have to talk to MtGox's server before delivering the final page to the user.
jr. member
Activity: 39
Merit: 1
Great,

i think i will tweak it a little and put it on www.bitcoinspot.nl

cheers!

Thanks.

I was using those image widgets before but they kept on breaking because the site operators got lazy in maintaining them.

This widget obviously pulls directly from Mt. Gox's API.  So as long as Mt. Gox API is working, this widget will continue to work correctly.

I also like it because I can format it however I want.
Pages:
Jump to: