modifying PHP to import ads with attachments w/ custom fields?? help!
I am trying to import my database of firearms to my site. I have created custom fields and the import.csv file has different fields.
How do I change the php or import fuctions to allow me to post with the custom fields? I tried modifying the import.php function but i am getting an error:
Warning: array_combine(): Both parameters should have an equal number of elements in /home/mattadika/public_html/
wp-content/themes/classipress/framework/admin/importer.php on line 165
please help? can someone tell me if this code is correct and if i need to modify importer.php?
// categories list display
function cp_create_categories_list( $location = 'menu' ) {
global $cp_options;
$prefix = 'cat_' . $location . '_';
$args['menu_cols'] = ( $location == 'menu' ? 3 : $cp_options->{$prefix . 'cols'} );
$args['menu_depth'] = $cp_options->{$prefix . 'depth'};
$args['menu_sub_num'] = $cp_options->{$prefix . 'sub_num'};
$args['cat_parent_count'] = $cp_options->{$prefix . 'count'};
$args['cat_child_count'] = $cp_options->{$prefix . 'count'};
$args['cat_hide_empty'] = $cp_options->{$prefix . 'hide_empty'};
$args['cat_nocatstext'] = true;
$args['cat_order'] = 'ASC';
$args['taxonomy'] = APP_TAX_CAT;
$args['custom_fields']['manufacturer'] = 'manufacturer';
$args['custom_fields']['model'] = 'model';
$args['custom_fields']['caliber'] = 'caliber';
$args['custom_fields']['firearm type'] = 'firearm type';
$args['custom_fields']['email'] = 'email';
$args['custom_fields']['phone'] = 'phone';
$args['custom_fields']['price'] = 'price';
return appthemes_categories_list( $args );
}
function childtheme_add_importer_args_filter( $args ) {
// add args
$args['custom_fields']['csv_extra_field_1'] = 'cp_extra_field_1';
$args['custom_fields']['csv_extra_field_2'] = 'cp_extra_field_2';
return $args;
}
add_filter( 'cp_csv_importer_args', 'childtheme_add_importer_args_filter', 10, 1 );
add_filter( 'cp_csv_importer_args', 'childtheme_add_importer_args_filter', 10, 1 );