hilmon
Forum Replies Created
-
Forum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Post ThumbnailThe only issue I would have with a URL approach would that I would want to use the ‘thumbnail’ version of the image in most instances. Altho, having said that I guess that would be dealt with in the page or post template.
The thing I really couldn’t figure out was the code that actually “attaches” an image (in the library or elsewhere) to a post.
Does WP use the url of the image when attaching an image to a page or post or does the image (in the library) have an id?
Sorry for the questions but I might as well take this opportunity to get my head around how this works as its been bugging me for months…
Forum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Post ThumbnailHi Fahdi,
That’s great news. I’ve used CSV Import to populate a couple of large catelogue site but then had to manually go and set the Featured image for each product.
In all cases I use custom post types and custom taxonomies.
Basically what most people seem to want (going by the posts I’ve read here on the forum) is to upload all images thru the media library and then reference the image file names in a column in the CSV. If possible it would be great to have the ability to reference multiple images…. a whole gallery of images to attach to a post.
Is that enough information?
Forum: Hacks
In reply to: Logical permalink structure with custom post and taxonomiesNo, I never found a solution. I couldn’t find a way get my desired structure of …
mydomain.com/%taxonomy%/%taxonomy-term%/%post-slug%
:-/
Forum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Post ThumbnailHa ha !!! I can see how it’s adding the images to an array etc… put can’t figure out how it all gets assigned and stored in the database…..
So its like we’ve won the cigar….. but no-one has a light :-/
Here are the csv column names by the way….
- Post Title
- Post Content
- Post Category
- productimage
- productimage1
- productimage2
- productimage3
- productimage4
- productimage5
- productimage6
- digital_product
- price
- spPrdLstDate
- specialprice
- weight
- istaxable
- size
- color
- affiliate_link
I’m sure I’m breaking every copyright law under the sun here…. but hey, desperate times call for desperate measures…
Forum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Post ThumbnailOk here it is …. It obviously handles the full CSV import (with upto 6 additional images) ….
<?php global $wpdb,$upload_folder_path; if($_POST) { if($_FILES['bulk_upload_csv']['name']!='' && $_FILES['bulk_upload_csv']['error']=='0') { $filename = $_FILES['bulk_upload_csv']['name']; $filenamearr = explode('.',$filename); $extensionarr = array('csv','CSV'); if(in_array($filenamearr[count($filenamearr)-1],$extensionarr)) { $destination_path = ABSPATH . $upload_folder_path."csv/"; $dest_arr = explode('/',$upload_folder_path."csv"); $root_pth = ABSPATH; for($i=0;$i<count($dest_arr);$i++) { $root_pth .= $dest_arr[$i].'/'; if (!file_exists($root_pth)) { mkdir($root_pth, 0777); } } $target_path = $destination_path . $filename; $csv_target_path = $target_path; if(@move_uploaded_file($_FILES['bulk_upload_csv']['tmp_name'], $target_path)) { $fd = fopen ($target_path, "rt"); ////////////////////////////post image directory start////////// global $General; $imagecustomkeyarray = array('productimage','productimage1','productimage2','productimage3','productimage4','productimage5','productimage6','digital_product'); // custom images and digital product html key names $imagepath = $General->get_product_imagepath(); if($imagepath == ''){$imagepath = 'products_img';} $destination_path = ABSPATH . "$upload_folder_path".$imagepath."/"; if (!file_exists($destination_path)) { $imagepatharr = explode('/',$imagepath); $upload_path = ABSPATH . "$upload_folder_path"; if (!file_exists($upload_path)) { mkdir($upload_path, 0777); } for($i=0;$i<count($imagepatharr);$i++) { if($imagepatharr[$i]) { $year_path = ABSPATH . "$upload_folder_path".$imagepatharr[$i]."/"; if (!file_exists($year_path)){ mkdir($year_path, 0777); } mkdir($destination_path, 0777); } } } $target_path = $destination_path . $name; $image_user_path = get_option( 'siteurl' ) ."/$upload_folder_path".$imagepath."/"; ////////////////////////////post image directory end////////// ///////////post digital product start//////////// $digital_product_path = $General->get_digital_productpath(); if($digital_product_path == '') { $digital_product_path = 'digital_products'; } $digital_destination_path = ABSPATH . "$upload_folder_path".$digital_product_path."/"; $imagepatharr = array(); if (!file_exists($digital_destination_path)){ $imagepatharr = explode('/',$digital_product_path); $upload_path = ABSPATH . "$upload_folder_path"; if (!file_exists($upload_path)){ mkdir($upload_path, 0777); } for($i=0;$i<count($imagepatharr);$i++) { if($imagepatharr[$i]) { $year_path = ABSPATH . "$upload_folder_path".$imagepatharr[$i]."/"; if (!file_exists($year_path)){ mkdir($year_path, 0777); } mkdir($digital_product_path, 0777); } } } $digital_target_path = $digital_destination_path . $name; $digital_user_path = get_option( 'siteurl' ) ."/$upload_folder_path".$digital_product_path."/".$name; /////////////////post digital product end//////// $taxonomysql = "select term_taxonomy_id,term_id from $wpdb->term_taxonomy where taxonomy='category'"; $taxonomyres = $wpdb->get_results($taxonomysql); $term_taxonomy_array = array(); foreach($taxonomyres as $taxonomyObj) { $term_taxonomy_array[$taxonomyObj->term_id] = $taxonomyObj->term_taxonomy_id; } $rowcount = 0; $customKeyarray = array(); while (!feof ($fd)) { $buffer = fgetcsv($fd, 4096); if($rowcount == 0) { for($k=3;$k<count($buffer);$k++) { $customKeyarray[$k] = $buffer[$k]; } }else { $post_title = addslashes($buffer[0]); $post_desc = addslashes($buffer[1]); $post_cat_arr = explode(',',$buffer[2]); // comma seperated category name if($post_title!='') { ////////////////////////////////////////////////////////// $post_info_arr = array(); $catids_arr = array(); $my_post = array(); if($post_cat_arr) { for($c=0;$c<count($post_cat_arr);$c++) { $catids_arr[] = get_cat_ID($post_cat_arr[$c]); } }else { $catids_arr[] = 1; } $my_post['post_title'] = $post_title; $my_post['post_content'] = $post_desc; if($post_info_arr['post_author']) { $my_post['post_author'] = $post_info_arr['post_author']; }else { $my_post['post_author'] = 1; } $my_post['post_status'] = 'publish'; $my_post['post_category'] = $catids_arr; //$my_post['tags_input'] = $post_info_arr['post_tags']; $last_postid = wp_insert_post( $my_post ); $customArr = array(); for($c=3;$c<count($buffer);$c++) { if(in_array($customKeyarray[$c],$imagecustomkeyarray)) { if(trim($buffer[$c])!='') { if(trim($buffer[$c]) == 'digital_product') { $customArr[$customKeyarray[$c]] = $digital_user_path.addslashes($buffer[$c]); }else { $customArr[$customKeyarray[$c]] = $image_user_path.addslashes($buffer[$c]); } } }else { $customArr[$customKeyarray[$c]] = addslashes($buffer[$c]); } } $customArr['posttype'] = 'product'; if($customArr) { update_post_meta($last_postid, 'key', $customArr); } ////////////////////////////////////////////////////////// } } $rowcount++; } echo '<br /><div id="message" class="updated below-h2">'; echo __("<br><br>csv uploaded successfully"); $rowcount = $rowcount-2; echo __("<br><br>Total of $rowcount records inserted</b>"); echo __(sprintf("<br><br>Upload images to %s folder.</b>",$destination_path)); echo '<br /><br /><br /></div>'; @unlink($csv_target_path); } else { $msg = "muerror"; } } }else { $msg = "ferror"; } } ?> <form action="<?php echo get_option('siteurl')?>/wp-admin/admin.php?page=bulkupload" method="post" name="bukl_upload_frm" enctype="multipart/form-data"> <style> h2 { color:#464646;font-family:Georgia,"Times New Roman","Bitstream Charter",Times,serif; font-size:24px; font-size-adjust:none; font-stretch:normal; font-style:italic; font-variant:normal; font-weight:normal; line-height:35px; margin:0; padding:14px 15px 3px 0; text-shadow:0 1px 0 #FFFFFF; } </style> <h2><?php _e('Bulk Upload'); ?></h2> <?php if($_REQUEST['msg']=='exist'){?> <div class="updated fade below-h2" id="message" style="background-color: rgb(255, 251, 204);" > <p><?php _e('Uploaded successully.'); ?></p> </div> <?php }?> <table width="75%" cellpadding="3" cellspacing="3" class="widefat post fixed" > <tr> <td width="14%"><?php _e('Select CSV file'); ?></td> <td width="86%">: <input type="file" name="bulk_upload_csv" id="bulk_upload_csv"></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="<?php _e('Submit'); ?>" onClick="return check_frm();" class="button-secondary action" > </tr> <tr> <td> </td> <td> </tr> <tr> <td colspan="2"><?php _e('You can download'); ?> <a href="<?php echo get_option('siteurl')?>/?page=csvdl"><?php _e('sample CSV file'); ?></a> </td> </tr> </table> </form> <script> function check_frm() { if(document.getElementById('bulk_upload_csv').value == '') { alert("<?php _e('Please select csv file to upload');?>"); return false; } return true; } </script>
Forum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Post ThumbnailOh WOW!!! Ouch!…..
I did use a premium theme a while ago https://templatic.com/ecommerce-themes/emporium that had this feature on its CSV importer… I had a look at the import script but it was a little beyond my limited php knowledge…
But I’ll have another look at it and post anything I think might be useful…
Forum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Post Thumbnail@bazonline… I spent a full day attaching 500 images to custom posts I had imported with CSV Imported….
It was hell …. Even filling in the image titles etc…. HELL!!!!!
A task I never want to repeat but unfortunately may have to in a few weeks…. :-/
I’ve been following this thread in hope!!!
Forum: Plugins
In reply to: eShop option/option sets orderingOoops!!! ….
Sorry a perfect example of RTFM!!!! ….
:-/
Forum: Plugins
In reply to: eShop option/option sets ordering@ Rich
Hi, I’ve noticed you’ve passed on some great advise to people using eShop so I’m hoping you might be able to help….
I’m having a similar issue with 5 long order forms for 5 different products (services)… and a very fussy client :-/. Its my first time using eShop, I’m kinda wishing the front end option sets just worked like Verse Meta boxes ??
Anyway, Can you suggest a way that I might be able to add a filter for each product so I can dictate the exactly order of the many options in each form… or maybe point me in the right direction?
Many thanks.
Forum: Fixing WordPress
In reply to: Display Categories & Posts based on single TagOk this is a real hack and is a little too reliant on elements having the same name but here’s the solution I came up with.
I created a page for each of the tags and gave them the same name.
In page.php ….
<?php $post_obj = $wp_query->get_queried_object(); // Get post data outside the loop $post_name = $post_obj->post_name; // Post Name and Tag must match $post_title = $post_obj->post_title; $args=array( 'orderby' => 'name', 'order' => 'ASC' ); $categories=get_categories($args); // get array of all categories foreach($categories as $category) { // loop thru each category $tag = explode(" ",$category->name); // get first word of category $title = explode(" ",$post_title); //get first word of page title if ( $title[0] == $tag[0]) { // if match .... the page matches category matches tag ..... !!! echo '<h1><a>term_id ) . '" title="' . sprintf( __( "View all news in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></h1>'; ?> <ul> <?php query_posts ( array ( 'category_name' => $category->name, 'posts_per_page' => -1 )); while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; wp_reset_query();?> </ul> <?php } } ?>
I’m sure there is a WP query which could have done the same job a lot better …. monday morning deadline :-/
Forum: Hacks
In reply to: Logical permalink structure with custom post and taxonomiesHi,
I’m stuggling with this quandary also. I was looking to have:
mydomain.com/%taxonomy%/%taxonomy-term%/%post-slug%.
or
mydomain.com/%post-type-slug%/%taxonomy-term%/%post-slug%.
as my taxonomy names are the same… or can be the same…. as the post type names…. althou this seems to cause issues when rewriting slugs.
I’ve read quite a few tutorials on the subject but none seems to answer this question directly!
Anyone??
Forum: Plugins
In reply to: [CSV Importer] [Plugin: CSV Importer] Post ThumbnailHi,
Firstly thanks for the great plug-in …. it’s going to save me so much time on a catalog site I’m building …..
I’ve the same request as jft.id … I have hunders of products to input and to be able to link to uploaded images would be brilliant!!…
….. but eh…. no pressure ?? … ha ha!
Forum: Fixing WordPress
In reply to: How to Display Multiple Custom Fields with Single ValuesThanks for that.
I’m sure this code could still be refined, but it does what I needed it to do…
$my_names = array("code","circa","date", "label"); $my_vars = array('$code','$circa','$date','$label'); $custom_fields = get_post_custom($post_id); $i=0; while($i<=4){ $my_custom_field = $custom_fields[$my_names[$i]]; foreach ( $my_custom_field as $key => $value ) $my_vars[$i] = $value ; echo $my_names[$i]." is ".$my_vars[$i]. "<br />"; $i++; }
Any suggestions on how I might refine this are very welcome!
:-p
Forum: Fixing WordPress
In reply to: Permissions so each WP user can only edit own pages/sub-pages?Hi Jeremy,
I know your post was 7 months ago …..
I’ve been searching for the exact same solution myself …. Did you find one??
Thanks
-Paul