Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.0   Updated Sunday, March 22nd, 2009 at 8:20pm

Stock Quotes Plugin for WordPress

This WordPress plugin allows you to easily display stock quotes on your website. The output of the plugin is designed to be minimal – the stock symbol, last price, and change amount are shown. You can configure the output in the options page for the plugin. The data is retrieved from Yahoo finance.

Download

  If you have found this page useful, please consider donating. Thanks!

Instructions

  • Download the above file, rename it from .txt to .php, and upload it to your plugins directory
  • Enable the plugin
  • Configure the plugin options (under DDStockQuotes)

Demo

MSFT 30.495 [-0.275]
GOOG 605.91 [-5.55]

Change Log

  • 03-22-09 Version 1.0 – First release

Usage

There are two ways this plugin can be used:

In a post or page:
[stock SYMBOL]

From a template file:
<?php echo ddsq_get_quote('SYMBOL'); ?>

* where SYMBOL is the stock symbol you want to use

Important note regarding symbols

For most stocks, you can simply use the standard symbol, but for some cases (such as indexes) you will have to use the proper tags from Yahoo Finance. First, use this URL to search for your stock/index/etc..

http://finance.yahoo.com/

Then when the results are shown, look at the URL. For example, searching for the Dow Jones Industrial Average. From the ’s’ parameter in the URL, and the symbol shown next to the name, you will see that it uses ^DJI. For the S&P 500, the tag is ^GSPC.

Options

Here are the options available in this plugin’s options page in the WordPress admin panel.

Output Format

This is the format of the plugin output. You can use any HTML you want, using the placeholders for the values: %NAME% %LAST% %CHANGE%

Example: <strong>%NAME%</strong> %LAST% [<strong>%CHANGE%</strong>]

Up Color

Color to use for price change when up (leave blank to disable)

Down Color

Color to use for price change when down (leave blank to disable)

Non-WordPress usage of the code

If you would like to use this script in your own PHP code, outside of WordPress, it is easy to do. All you need is the ddsq_get_quote function from the plugin, replacing the three lines at the start of the function (which pull the option settings from WordPress), with the actual option strings. Example:

$quote_format = '<strong>%NAME%</strong> %LAST% [<strong>%CHANGE%</strong>]';
$up_color = '00BB00';
$down_color = 'FF0000';
  1. Ah well your comment! I did you good!FDR

  2. Am I able to show the percentual change of a stock instead?

    Awesome plugin btw!

  3. Its interesting. I would like to know more about this…I really wanted to know how this works can you please help me out…….Thanks for sharing.yheas

  4. ne of the the reason wh

  5. tips and coach bags for cheap coupons and de

  6. flap covers the envelope

  7. Marketing way side-by-side luxury goods

  8. Only Christian Louboutin can deliver drool-worthy pumps that make our hearts skip a beat!

  9. 56
    Peter Brock

    I’ve tried all the stock quote plugins for Wordpress and this one is by far the best for my needs. Minimal, flexible, and easy to use. Surprisingly low profile and hard to find but I am grateful for it.

  10. Thanks for the article, I’ll think about what you mentioned in it. It’ an interesting point of view.

  11. Now I know what I need to do. Thanks ever so much.

  12. Researchers recently gathered in Goteborg, Moncler Giubbotti Sweden, planning the slaughter of livestock can not get meat approach. Over the past 10 years scientists have been studying meat painless method, but later appeared in several false dawn, did not change an indisputable fact. Gothenburg, Chalmers University of Technology Julie – Gould said: “No one has yet to produce in vitro meat.” She was responsible for organizing the meeting. University of Maastricht, the Netherlands, according to Mark – Poster said that the first lab-grown out of the sausage may become a reality within six months, he was the main pioneer of this Moncler Giacche technology and loyal supporters. Poster has been tested using pig cells, recently found in a laboratory environment to cultivate muscle tissue method. And he has cultivated a similar muscle meat, each of length 2.5 cm, width 0.7 cm

  13. it’s very useful.hndfh

  14. n It’s my first time to read like this article gresw

  15. Thank you so very much for taking the time to share…very useful, indeed!xccv

  16. Thanks for a nice share you have given to us with such an large collection of information fddffd

  17. Very nice and clear concept.

  18. Absolutely helpful post. Keep it up.

  19. Very nice and explicit instruction. Do keep it as simple as it is.

  20. Very Nice one! thanks so much!

  21. Hi, I am using the plugin but I keep getting MISSING SYMBOLS LIST. [] error when trying to add the Dow Jones Industrial (^DJI). Any help would be appreciated.

  22. all of these articles are the same, there is nothing I have not come across in the past year that is any news to us.seems like everyone has run out of proper ideas
    cogumelos magicos

  23. 42
    Alice

    Thanks for the great article, thanks for sharing with us.

    Daycare Forms

  24. I visited this page first time and found it Very Good Job of acknowledgment and a marvelous source of info………Thanks Admin!

  25. 40
    health administration

    you give so many great tips especially since I use word press and the plug-in section of your blog is great. some of the tips i get here I can’t find anywhere else. health administration

  26. Nice updates. Yet there is a lot to learn to be perfect.

  27. 38
    Miarn

    having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Th

  28. I checked out SWEET and Events.org (who we used) was far better priced then them. Rubbish

  29. Thanks for the great article, thanks for sharing with us wholesale imitation jewelry

  30. I want to be a part of this mags. I have idea to make a good design and to make a good layout for this mags. We need to make other people to feel interesting by see our mags cover, then they will buy itbachelor criminal justice

  31. My 2 year old son has been in the hospital for bilateral pleural chylous effusions since Jan 29, p/o Fontan in November of 2009. He has tried diet, diuretics, thoracic duct ligation and now pleurodesis on the right side. masters of public administration

  32. Who is anyone to question whether or not someone comes out as being gay or not, perhaps they just don’t want the public to know their sexuality, whether that be gay or straight. That’s their choice and their right.

  33. Very Nice one! thanks so much!

  34. Companies these days are using ergonomic furniture to ensure that there are no injuries from work related hazards. Use an ergonomic chair and feel better comfort in your back and shoulde.
    sport management master

  35. What symbols do I use to display DJIA, NASDAQ & S&P500? DJIA does not seem to work. Thanks.

    healthcare mba

  36. Thanks so much! Great plugin.
    wmv to dvd, mov to dvd

  37. 28
    person_guyz

    Companies these days are using ergonomic furniture to ensure that there are no injuries from work related hazards. Use an ergonomic chair and feel better comfort in your back and shoulde
    online rn to bsn

  38. 27
    person_guyz

    First thanks for script, very nice and works with wordpress beatifully. Secondly, i have an error on the site when i put in symbols. I followed the direction, but maybe i missed something or this is not compatible with 2.9.2
    health informatics programs

  39. 26
    jibran

    Companies these days are using ergonomic furniture to ensure that there are no injuries from work related hazards. Use an ergonomic chair and feel better comfort in your back and shoulder. gratis spel

  40. Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.

  41. 24
    jibran

    Companies these days are using ergonomic furniture to ensure that there are no injuries from work related hazards. Use an ergonomic chair and feel better comfort in your back and shoulder. Mattress Pad

  42. is a pleasant, time-saving and profitable experience. Please feel free to contact us if you have any questions.Our website is

    china suppliers

  43. Here are the options available in this plugin’s options page in the WordPress admin panel.

  44. Hi I’m geting this:
    “AAPL”,322.21,0.00,”0.00%”,1600,18152700,314.898,279.967,N/A,295.6B,0.50,”190.25 – 325.06″,370.55
    I’ve add [[AAPL]] to end of page and I see this on up of page.

  45. Really great, works good for me. Thankx!

  46. 19
    Peter Brock

    The plugin works nicely. However, I’m using the stock quotes in a table, and some quotes return 4 decimal places. Is there a way to limit the price to two decimal places?

  47. We supply all kinds of moncler boots,moncler bags,moncler coats,moncler jackets,moncler T-shirt,moncler vest and so on.We have got a good reputation pf our products with top quality and good price.We sincerely look forward to futher cooperation with you for mutual benefits.We are sure that you will find working with us is a pleasant, time-saving and profitable experience. Please feel free to contact us if you have any questions.Our website is http://www.newlyapparel.com.

  48. Thanks for the plugin.

  49. Hey,

    First thanks for script, very nice and works with wordpress beatifully. Secondly, i have an error on the site when i put in symbols. I followed the direction, but maybe i missed something or this is not compatible with 2.9.2

    Here is the site Indie Stocks – Stocks under $5

    Thanks for your help!

  50. Dear Visitors,

    This blog is really nice and informative. We are pleased to know this blog is really helping people.
    It’s our pleasure to post informative content on this useful blog created by webmaster.
    THERE is a one stock that gives 400% profit in a year .
    from 10 years 2000 to 2010 it gives these types of profit .
    we make 3 times money in it .
    If some body want to check this stock status , just check the performance of this stock before invest ,
    no one can make these types of profit through trading .
    so just invest and make your money 400% in 1 year .
    our services are free of cost .
    to do so pls contact us at our site amarinvestments

    amarinvestments

  51. rally nice plugin..i was thinking for the same type for my blog.it really looks cool like the cnn and other websites

  52. Great Plugin.. Thanks for sharing..

  53. Awesome plugin! Really appreciate the effort that you put into this. In exchange for this wonderful tool, I’d like to share a site with you guys that has helped me tremendously with not only learning how to backtest my strategy for free, but it’s also a place where there’s a good community of seasoned investors and day traders willing to help. The site is wikinancial.com

  54. This plugin has been tested, and works, with the latest release of WordPress – 2.8

    For those asking about the demo – the stock information you see above is live output from the plugin.

  55. Where can I see the demo?

  56. I have lots of contents on Economy, Company news, Stock recommendations, Warren Buffett and much more.

  57. Nice thank you, i really like it.

  58. Nice plugin, thank you man!

  59. Currently there is no caching done – as people generally want up to date stock quotes, but I will consider it as an optional setting in the next release.

  60. 5
    Stephen

    Question: how is caching handled for the stock quotes? Is Yahoo Finance queried each time the page is loaded, or can this be cached to every 15/30/45/60 minutes?

  61. This is a great plugin. I should be using this at my blogs. Thanks

  62. 3
    Eric Morris

    Here is the code for the three main indices: DJIA: NASDAQ: S&P 500:

    Thanks for your help.

  63. Eric: Thanks for pointing that out. It looks like it has to do with the symbols Yahoo Finance uses (which is where this data comes from).

    I added instructions above (see ‘Important note regarding symbols’ section), to find out what the exact symbol they are using for whatever you are searching for.

  64. 1
    Eric Morris

    What symbols do I use to display DJIA, NASDAQ & S&P500? DJIA does not seem to work. Thanks.

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.