Reading csv from specific directory and insert it to custom post type (cron job)
Reading csv from specific directory and insert it to custom post type (cron job)
Reading csv from specific directory and insert it to custom post type (cron job)
You may want to considering using the WP Ultimate CSV Importer Plugin instead with this you can map the different fields in the CSV to the columns in wordpress (source: wordpress.org)
simple batch file would do that: DIR %1 /B /S >files.csv Save as a bat file and place it in the root directory. Run the bat and will output directories and file names to files.csv same location as the bat file.
Firstly it is always best to avoid HTML in your data especially divs. There is plenty CSS from what I can see and I’m guessing none of those styles would be used in the final blog. So it would result in a lot of inert code, not good practice and it is best to spend … Read more
I would like to import two columns into WordPress
Not tested but this should work: add_action(‘manage_pages_custom_column’, ‘display_page_custom_cols’, 10, 2); function display_page_custom_cols($col_name, $post_id) { global $wpdb; $user_group = $wpdb->get_results(“SELECT * From custom_user_group”,OBJECT_K); if (‘user_group’ == $col_name) { $pages = explode(‘,’,get_post($post_id)); $output = array(); foreach ($pages as $page ) { $output[] = $user_group[$page]->GroupName; } echo implode(‘,’,$output); } }
The granularity of data in your example suggests that custom field (more so one with multiple values) would be wrong choice in first place. Think about it like this: only one dog might weight precisely 35.5kg — that is type of data appropriate for custom field multiple dogs (or dog breeds) might be of medium … Read more
Create csv file in plugin
With the help of a more knowledgeable colleague, we got it working. Here’s the code: /** Add custom column headers **/ function wc_csv_export_modify_column_headers( $column_headers ) { $new_headers = array( ‘fund’ => ‘fund’, ‘appeal’ => ‘appeal_code’, ); return array_merge( $column_headers, $new_headers ); } add_filter( ‘wc_customer_order_csv_export_order_headers’, ‘wc_csv_export_modify_column_headers’ ); /** Set the data for each for custom columns … Read more
No need to code for this one as it was already solved by mikemanger with the plugin Batch Posts 2 Posts for, as the name says, batch creation of relations using Posts 2 Posts plugin framework. As in their description: This plugin makes it easy to create relations using the Posts 2 Posts plugin. For … Read more