Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // [demo_stock_quote symbol="MSFT"]
- add_shortcode( 'demosq', 'demo_stock_quote' );
- function demo_stock_quote( $atts, $content = null ) {
- $atts = shortcode_atts( array(
- 'symbol' => 'AAPL'
- ), $atts );
- if ( ! class_exists( 'Wpau_Stock_Quote' ) ) {
- return "We can not get data for symbol $symbol at the moment";
- }
- $sq = new Wpau_Stock_Quote();
- $data = $sq->get_stock_from_db( $atts['symbol'] );
- if ( ! empty( $data ) ) {
- return print_r( $data, true );
- }
- return "We have no data for $symbol";
- } // EOF demo_stock_quote()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement