[amazon trackingid="YOUR-CAMPAIGN-ID" keywords="YOUR-STORE-KEYWORDS" rows="NUMBER-OF-ROWS-YOU-WANT-TO-DISPLAY" columns="NUMBER-OF-COLUMNS-YOU-WANT-TO-DISPLAY" pagination="yes" logo="LOGO-OPTION" customcss="SOME-IDENTIFIER"] Use spaces between the keywords. You can also display the store as a widget. Author: GeekLad Version: 1.0 Author URI: http://geeklad.com/ License: GPL */ /* Copyright 2009 GeekLad (email : geeklad@geeklad.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ add_shortcode('amazon', 'amazon_store_display'); function amazon_store_display($atts) { extract(shortcode_atts(array( 'trackingid' => false, 'keywords' => false, 'rows' => '5', 'columns' => '2', 'pagination' => false, 'customcss' => false, 'logo' => 'white', ), $atts)); if (!$keywords || !$trackingid) return ""; if ($pagination && $pagination != "none") { $pagination = "&pagination=yes"; if ($_GET['pagenumber']) $pagination .= "&pagenumber=" . $_GET['pagenumber']; else $pagination .= "&pagenumber=1"; } if ($customcss && $customcss != "none") $customcss = "&customcss=sidebar"; $logo = "&logo=" . $logo; $keywords = urlencode($keywords); $storeurl = "http://geeklad.com/tools/amazon/amazon.php?trackingid=$trackingid&rows=$rows&columns=$columns$pagination$customcss$logo&keyword=$keywords"; return file_get_contents($storeurl); } add_action("plugins_loaded", "amazon_store_widget_init"); function amazon_store_widget_init() { wp_register_widget_control("free_amazon_store_widget", __('Amazon Niche Store'), 'amazon_store_widget_control'); wp_register_sidebar_widget("free_amazon_store_widget", __('Amazon Niche Store'), 'amazon_store_widget', array('description' => __('Display an Amazon store as a widget.'))); } function amazon_store_widget_control() { $options = $newoptions = get_option('amazon_store_widget'); if ( $_POST["amazon_store_widget_submit"] ) { $newoptions['title'] = $_POST["amazon_store_widget_title"]; $newoptions['trackingid'] = $_POST["amazon_store_widget_trackingid"]; $newoptions['keywords'] = $_POST["amazon_store_widget_keywords"]; $newoptions['itemcount'] = $_POST["amazon_store_widget_itemcount"]; $newoptions['css'] = str_replace("\"", "'", str_replace("\\", "", $_POST["amazon_store_widget_css"])); } if ( empty($options['keywords']) && empty($options['trackingid']) ) { $title = "Buy on Amazon"; $keywords = ""; $itemcount = 3; $css = ".amazon-store-sidebar, .amazon-store-sidebar table { font-size: small; font-family: verdana,arial,helvetica,sans-serif; width: 100%; min-width: 100%; } .amazon-store td { vertical-align: top; font-size: small; } .amazon-store-sidebar-title { text-decoration: none; font-weight: bold; font-size: 110%; } .amazon-store-sidebar-price { color: #990000; font-weight: bold; text-decoration: none; } .amazon-store-sidebar-price strike { color: #000000; font-weight: normal; } .amazon-store-sidebar-view-details { text-decoration: underline; color: #004B91; font-family: verdana,arial,helvetica,sans-serif; } .amazon-store-sidebar-footer { line-height: 14px; font-size: 10px; font-style: italic; margin-top: -10px; font-family: verdana,arial,helvetica,sans-serif; } "; } else { $title = $newoptions['title']; $trackingid = $newoptions['trackingid']; $keywords = $newoptions['keywords']; $itemcount = $newoptions['itemcount']; $css = $newoptions['css']; } if ( $options != $newoptions ) { $options = $newoptions; update_option('amazon_store_widget', $options); } ?>
" . $options['css'] . ""; echo $before_title . $title . $after_title; echo str_replace("\\", "", $before); echo amazon_store_display($options); if ( '%BEG_OF_TITLE%' != $args['before_title'] ) wp_cache_add('amazon_store_widget', ob_get_flush(), 'widget'); } } ?>