Warning: Creating default object from empty value in /home/design/public_html/wp-content/plugins/paged-comments/paged-comments.php on line 31
Stock Quotes Plugin for WordPress · Dagon Design

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 44.87 [-0.135]
GOOG 571.00 [-6.86]

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';

Pages: [7] 6 5 4 3 2 1 » Show All

  1. You have so much to learn, and even if you have been trying for two or three years, you still have so much to learn.
    When the website visitors click on the ads or banner, you get paid as the owner of such website.
    He doesn’t utilize hard selling methods to produce a buck, he rarely uses soft
    marketing methods.

  2. But you can make an informed decision which makes all difference.

    Film make-up artists apparently always know what the actor has
    been doing just by the way their skin feels. Also apply the tanner on the earlobes and upper
    ears.

  3. You will have better choices, less fuss and you are less likely to have that little voice in your
    head putting you down. This variety of swimwear has been put into use since
    the 1940s and is still a popular form of swimwear in North America.
    t wait for those steamy, hot days of summer so she can break
    out her bikini and confidently strut her stuff on the beach and by the pool.

  4. One other gift basket variation would be a “sexy” gift basket
    loaded with eatable lotions, a bottle of champagne and naughty games or perhaps toys.
    As everything can now be accessed on the Internet,
    it seems that I can easily do errands or spend my work hours with my fingers doing the job, well, done.

    Subscribe to the Sales & Deals Examiner for instant email updates on more
    last-minute holiday deals.

Pages: [7] 6 5 4 3 2 1 » Show All

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.