'; echo ''; // The actual fields for data entry if(get_option('apipp_amazon_associateid')==''){ echo '

WARNING: You will not get credit for Amazon purchases until you add your Amazon Affiliate ID on the options page.

'; } echo ' '; if(get_post_meta($post->ID, 'amazon-product-isactive', true)!=''){$menuhide="checked";}else{$menuhide="";} echo '

   if checked the product will be live

'; echo ' '; if(get_post_meta($post->ID, 'amazon-product-content-hook-override', true)=='2' || (get_post_meta($post->ID, 'amazon-product-content-hook-override', true)=='' && get_option('apipp_hook_content')==true)){$hookcontent="checked";}else{$hookcontent="";} echo '

   if checked the product will be added when the_content() is used. On by default unless set in options.

'; echo ' '; if(get_post_meta($post->ID, 'amazon-product-excerpt-hook-override', true)=='2' || (get_post_meta($post->ID, 'amazon-product-excerpt-hook-override', true)=='' && get_option('apipp_hook_excerpt')==true)){$hookexcerpt="checked";}else{$hookexcerpt="";} echo '

   if checked the product will be added to the EXCERPT when the_excerpt() is used. Off by default unless set in options.

'; echo ' '; if(get_post_meta($post->ID, 'amazon-product-singular-only', true)=='1'){$singleonly="checked";}else{$singleonly="";} echo '

   if checked the product will only show when in single view. In other words, only when on the permalink page. Off by default.

'; echo ' '; if(get_post_meta($post->ID, 'amazon-product-newwindow', true)=='2' || (get_post_meta($post->ID, 'amazon-product-newwindow', true)=='' && get_option('apipp_open_new_window')==true)){$newwin="checked";}else{$newwin="";} echo '

   if checked the product will open a new browser window. Off by default unless set in options.

'; //echo ' '; //if(get_post_meta($post->ID, 'amazon-product-showusbutton', true)=='1' || (get_post_meta($post->ID, 'amazon-product-showusbutton', true)=='' && get_option('apipp_open_showusbutton')==true)){$newwin="checked";}else{$newwin="";} //echo '

   if checked and your Locale is set to anything other than US(.com), an addtional Buy button with Amazon.com will be shown. Off by default.

'; echo ''; echo '

  ID, 'amazon-product-content-location', true)==='1') || (get_post_meta($post->ID, 'amazon-product-content-location', true)=='') ? "checked" : '') .' /> Above Post Content - Default - Product will be first then post text
'; echo '  ID, 'amazon-product-content-location', true)==='3') ? "checked" : '') .' /> Below Post Content - Post text will be first then the Product
'; echo '  ID, 'amazon-product-content-location', true)==='2') ? "checked" : '') .' /> Post Text becomes Description - Post text will become part of the Product layout

'; echo '
'; echo '

   You will need to get this from Amazon.com

'; } /* When the post is saved, saves our custom data */ function amazonProductInAPostSavePostdata($post_id, $post) { if($post_id==''){$post_id=$post->ID;} /* if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) return $post_id; } else { if ( !current_user_can( 'edit_post', $post_id )) return $post_id; } */ if(!isset($_POST['post_save_type_apipp'])){return;} $mydata['amazon-product-isactive'] = $_POST['amazon-product-isactive']; $mydata['amazon-product-content-location'] = $_POST['amazon-product-content-location']; $mydata['amazon-product-single-asin'] = $_POST['amazon-product-single-asin']; $mydata['amazon-product-excerpt-hook-override'] = $_POST['amazon-product-excerpt-hook-override']; $mydata['amazon-product-content-hook-override'] = $_POST['amazon-product-content-hook-override']; $mydata['amazon-product-newwindow'] = $_POST['amazon-product-newwindow']; //$mydata['amazon-product-showusbutton'] = $_POST['amazon-product-showusbutton']; $mydata['amazon-product-singular-only'] = $_POST['amazon-product-singular-only']; if($mydata['amazon-product-isactive']=='' && $mydata['amazon-product-single-asin']==""){$mydata['amazon-product-content-location']='';} if($mydata['amazon-product-excerpt-hook-override']==''){$mydata['amazon-product-excerpt-hook-override']='3';} if($mydata['amazon-product-content-hook-override']==''){$mydata['amazon-product-content-hook-override']='3';} if($mydata['amazon-product-newwindow']==''){$mydata['amazon-product-newwindow']='3';} // Add values of $mydata as custom fields foreach ($mydata as $key => $value) { //Let's cycle through the $mydata array! if( $post->post_type == 'revision' ) return; //don't store custom data twice $value = implode(',', (array)$value); //if $value is an array, make it a CSV (unlikely) if(get_post_meta($post_id, $key, FALSE)) { //if the custom field already has a value update_post_meta($post_id, $key, $value); } else { //if the custom field doesn't have a value add_post_meta($post_id, $key, $value); } if(!$value) delete_post_meta($post_id, $key); //delete if blank } } function apipp_plugin_menu() { global $fullname_apipp, $shortname_apipp, $options_apipp; apipp_options_add_admin_page($fullname_apipp,$shortname_apipp,$options_apipp); add_menu_page('Amazon Page In a Post New', 'Amazon PIP', 8, 'apipp-add-new', 'apipp_add_new_post'); add_submenu_page('apipp-add-new', $fullname_apipp." Options", "Amazon PIP Options", 8 , $shortname_apipp."_plugin_admin", 'apipp_options_add_subpage'); //add_submenu_page('apipp-add-new', 'New Product Post', 'New Product Post', 8, 'apipp-add-new', 'apipp_add_new_post'); } function apipp_add_new_post(){ global $user_ID; global $current_user; get_currentuserinfo(); $myuserpost = $current_user->ID; echo '

Add New Amazon Product Post

'; if($_GET['appmsg']=='1'){ echo '

Product post has been saved. To edit, use the standard Post Edit options.

';} echo '
This function will allow you to add a new post for an Amazon Product - no need to create a post then add the ASIN.
Once you add a Product Post, you can edit the information with the normal Post Edit options.
'; ?>
Title
Post Status
Amazon Product ASIN Number (may also be called ISBN-10)
Post Content
   
Product Location    Above Post Content - Default - Product will be first then post text
   Below Post Content - Post text will be first then the Product
   Post Text becomes Description - Post text will become part of the Product layout
   
Post Category cat_ID . '" /> ' . $cat->cat_name . '
'; $ii=$ii+1; } ?>