'; 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 ''; 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']; if($mydata['amazon-product-isactive']=='' && $mydata['amazon-product-single-asin']==""){$mydata['amazon-product-content-location']='';} // 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; } ?>