Boost your Earning with Amazon Custom Thumbnail Plugin

Free Amazon Custom Thumbnail PluginTo make your amazon website be an attractive, and increase your earnings, I will share plugin and tips to create amazon custom thumbnail plugin. For you that use free wordpress theme for selling amazon’s products, Amazon custom thumbnail can be your first choice to build a your amazon wordpress site.

 Features that we get when using amazon custom thumbnail plugin. 

  • Display the rating of products.
  • Display the List price with strike tag.
  • Display the price of products.
  • Displays the percentage discounts.
  • Display detail products button (will link at amazon site with your amazon associate tag )
  • Display Add to cart button ( will link to the amazon site add cart form).

 Okay, time for us to review step by step how to create amazon custom thumbnail plugin. 

If previously I have made asin grabber plugin, this is my second plugin. I more satisfied using my own plugin rather than buying a plugin with an expensive price. Besides being able modified to suit our taste, can also add to our knowledge about wordpress plugin and we can sell it.

For build this amazon custom thumbnail plugin, i choose DW WallPress as theme. Maybe you can choose the other free wordpress themes for wallpaper’s site.

  • Create new folder as act_amazon_custom_thumbnail.
  • Create php file as act_amazon_custom_thumbnail.php
  • Write this script at act_amazon_custom_thumbnail.php.

<?php
/*
Plugin Name: Amazon Custom Thumbnail
Plugin URI: n/a
Description: Create an attractive thumbnail display for your amazon affiliate sites.
Version: 1.0 .
Author: Sigit Prasetya Nugroho.
Author URI: http://seegatesite.com

License: GPL2

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.

    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.

*/
add_filter('post_thumbnail_html','act_amazon_custom_thumbnail',10);
function act_amazon_custom_thumbnail( $html ) {
        global $post;
		$html ='</a><div>';
		if(!is_single() && !is_attachment() )
		{
				$name = get_post_meta($post->ID, 'azon_image', true);
				$rating = get_post_meta($post->ID, 'azon_rating', true);
				$price = get_post_meta($post->ID, 'azon_price', true);
				$list_price = get_post_meta($post->ID, 'azon_listprice', true);
				$url = get_post_meta($post->ID, 'azon_url', true);
				$cart = get_post_meta($post->ID, 'azon_cart', true);
				$titles=get_the_title();
				if( $name )
				{
						$html .= '<div align="center"><img src="'. esc_url( $name ).'" title="'.$titles.'" alt="'.$titles.'" ></div>';
				}
				if( $rating )
				{
						$html .= '<div align="center"><img src="' . plugins_url( 'act_amazon_custom_thumbnail/images/'.$rating.'.gif', dirname(__FILE__) ) . '"  style="width:70px;float:left" alt="'.$titles.' product rating" /></div><br />
<hr/>';
				}
				$html .='<div style="margin-bottom:5px;">';
				if( $list_price )
				{
						$html .= '<div align="left" style="font-family: Arial, Helvetica, sans-serif;
	font-size:12px;"><label>List Price : $</label><label style="color:grey;"><s> '.number_format($list_price).'</s></label></div>';
				}
				if( $price )
				{
	$html .= '<div align="left" style="font-family: Arial, Helvetica, sans-serif;
	font-size:12px;"><label><b>Price :</label><label style="font-size:14px;color:red;"> $ '.number_format($price).'</b></label></div>';
				}
				if( $list_price && $price )
				{
					if ($list_price > $price)
					{
						$save_point= ($list_price - $price);
						$save_prcn= (($list_price - $price)*100)/$list_price;
	$html .= '<div align="left" style="font-family: Arial, Helvetica, sans-serif;
	font-size:12px;"><label>You Save :</label><label style="font-size:12px;color:red;"> $ '.number_format($save_point).' ('.number_format($save_prcn).'%)</label></div>';
					}
				}
					$html .='</div>';
				if( $url )
				{
						$html .= '<a style="cursor: pointer; text-decoration: none;" href="'.$url.'" target="_blank"  rel="nofollow" title="Add to cart"><img src="' . plugins_url( 'act_amazon_custom_thumbnail/images/buy_now.png', dirname(__FILE__) ) . '"  style="height: 22px;width: auto;float:left" alt="'.$titles.' check price and available at amazon site" title="'.$titles.' check price and available at amazon site" /></a>';
				}
				if( $cart )
				{
						$html .= '<a style="cursor: pointer; text-decoration: none;" href="'.$cart.'" target="_blank"  rel="nofollow" title="Add to cart"><img src="' . plugins_url( 'act_amazon_custom_thumbnail/images/add_cart.png', dirname(__FILE__) ) . '"  style="height: 22px;width: auto;float:right" alt="add to cart" alt="'.$titles.' add to amazon cart" /></a><br />';
				}
		}
		$html .='</div>';
		return $html;
}
add_action( 'publish_post', 'act_add_thumbnail_id' );
add_action( 'save_post', 'act_add_parameter' );

function act_add_thumbnail_id($postid) {
    if(!wp_is_post_revision($postid)) {
        $field_name = '_thumbnail_id';
        add_post_meta($postid, $field_name, '-1', true);
    }
}
function act_add_parameter($postid) {
    if(!wp_is_post_revision($postid)) {
        add_post_meta($postid, 'azon_image', '', true);
        add_post_meta($postid, 'azon_price', '', true);
        add_post_meta($postid, 'azon_url', '', true);
        add_post_meta($postid, 'azon_cart', '', true);
	add_post_meta($postid, 'azon_listprice', '', true);
	add_post_meta($postid, 'azon_rating', '', true);
    }
}
?>

  • Create new folder in the act_amazon_custom_thumbnail folder and give name as  images  .
  • Download image here and paste in folder  images

rating.png

  • Finish and compress your act_amazon_custom_thumbnail folder into  zip format .

I will give a little explanation about the script above :

  • For create WordPress plugin , PHP file must contain a standard Plugin information header. This header lets WordPress recognize that your plugin exists.
/*
Plugin Name: Amazon Custom Thumbnail
Plugin URI: n/a
Description: Create an attractive thumbnail display for your amazon affiliate sites.
Version: 1.0 .
Author: Sigit Prasetya Nugroho.
Author URI: http://seegatesite.com

License: GPL2

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License, version 2, as
    published by the Free Software Foundation.

    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.

*/
  • Create add_filter hooks and apply to post_thumbnail_html function ( Output HTML for the post thumbnail meta-box.) and callback act_amazon_custom_thumbnail function when the custom Filter is applied. (read more here for more information).
add_filter('post_thumbnail_html','act_amazon_custom_thumbnail',10);
  • Create function act_amazon_custom_thumbnail( $html ). In order to executed the script besides the post page and attachments page, we need statement if(!is_single() && !is_attachment() )
  • Create custom field parameter to save your amazon thumbnail data with this syntax below.
add_action( 'publish_post', 'act_add_thumbnail_id' );
add_action( 'save_post', 'act_add_parameter' );

function act_add_thumbnail_id($postid) {
 if(!wp_is_post_revision($postid)) {
 add_post_meta($postid, '_thumbnail_id', '-1', true); 
 }
}
function act_add_parameter($post) {
 if(!wp_is_post_revision($post)) {
 add_post_meta($post, 'azon_image', '', true); 
 add_post_meta($post, 'azon_price', '', true); 
 add_post_meta($post, 'azon_url', '', true); 
 add_post_meta($post, 'azon_cart', '', true); 
 add_post_meta($post, 'azon_listprice', '', true); 
 add_post_meta($post, 'azon_rating', '', true); 
 }
}

add_action( ‘publish_post’, ‘act_add_thumbnail_id’ ) ,  Function act_add_thumbnail_id will applied when you publish your post (or click publish).

add_action( ‘save_post’, ‘act_add_parameter’ ), Function act_add_parameter will applied when you create new post (or click add new post).

azon_image : fill this custom field with your image url.
azon_price : fill this custom field with price.
azon_url : fill this custom field with url of amazon product . And don’t forget to include your amazon associate tag.
azon_cart : fill this custom field with url of amazon cart link.
azon_listprice : fill this custom field with listprice before discount.
azon_rating : fill this custom field with rating (give value 1,2,3,4).

For set featured image on your post, we need insert post meta with key “_thumbnail_id”, give the value -1.

function act_add_thumbnail_id($postid) {
 if(!wp_is_post_revision($postid)) {
 add_post_meta($postid, '_thumbnail_id', '-1', true);
 }
}

After you successfully create custom thumbnail amazon script, here’s how to use the plugin

  • Go to plugins ->add new, upload and then install and active that plugin.

amazon thumbnail plugin

  • Then create new post, active your custom fields screen.

active custom fields to setting amazon custom thumbnail

  • Fill custom fields below the post box.

amazon custom thumbnail custom fields

 

  • Publish your post, and see the result 🙂

You can modified that script with add as you like. If you need to download my plugin , download plugin below , Please share my article before you download it 🙂  

 .

If you have trouble, find some bug, or get idea for this amazon custom thumbnail plugin, please give me comment bellow 🙂

My Amazon Custom Thumbnail Plugin New Version Launch, read here 🙂

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

2 Comments

 Add your comment
  1. These are actually enormous ideas in regarding blogging.

    You have touched some fastidious points here. Any way keep up wrinting.

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: