| @@ -65,15 +65,15 @@ | ||
| 65 | 65 | global $wpdb; |
| 66 | 66 | |
| 67 | 67 | $fields = [ |
| 68 | 68 | 'key' => 'main', |
| 69 | - 'label' => 'Post', | |
| 69 | + 'label' => __('Post', 'jc-importer'), | |
| 70 | 70 | 'loop' => true, |
| 71 | 71 | 'fields' => [], |
| 72 | 72 | 'children' => [ |
| 73 | 73 | 'author' => [ |
| 74 | 74 | 'key' => 'author', |
| 75 | - 'label' => 'Author', | |
| 75 | + 'label' => __('Author', 'jc-importer'), | |
| 76 | 76 | 'loop' => false, |
| 77 | 77 | 'fields' => [], |
| 78 | 78 | 'children' => [] |
| 79 | 79 | ], |
| @@ -78,9 +78,9 @@ | ||
| 78 | 78 | 'children' => [] |
| 79 | 79 | ], |
| 80 | 80 | 'image' => [ |
| 81 | 81 | 'key' => 'image', |
| 82 | - 'label' => 'Featured Image', | |
| 82 | + 'label' => __('Featured Image', 'jc-importer'), | |
| 83 | 83 | 'loop' => false, |
| 84 | 84 | 'fields' => ['id', 'url', 'title', 'alt', 'caption', 'description'], |
| 85 | 85 | 'children' => [] |
| 86 | 86 | ], |
| @@ -85,9 +85,9 @@ | ||
| 85 | 85 | 'children' => [] |
| 86 | 86 | ], |
| 87 | 87 | 'parent' => [ |
| 88 | 88 | 'key' => 'parent', |
| 89 | - 'label' => 'Parent', | |
| 89 | + 'label' => __('Parent', 'jc-importer'), | |
| 90 | 90 | 'loop' => false, |
| 91 | 91 | 'fields' => ['id', 'name', 'slug'], |
| 92 | 92 | 'children' => [] |
| 93 | 93 | ], |
| @@ -92,9 +92,9 @@ | ||
| 92 | 92 | 'children' => [] |
| 93 | 93 | ], |
| 94 | 94 | 'custom_fields' => [ |
| 95 | 95 | 'key' => 'custom_fields', |
| 96 | - 'label' => 'Custom Fields', | |
| 96 | + 'label' => __('Custom Fields', 'jc-importer'), | |
| 97 | 97 | 'loop' => true, |
| 98 | 98 | 'loop_fields' => ['meta_key', 'meta_value'], |
| 99 | 99 | 'fields' => [], |
| 100 | 100 | 'children' => [] |
| @@ -156,15 +156,15 @@ | ||
| 156 | 156 | ]; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $fields['children']['custom_fields']['fields'] = apply_filters('iwp/exporter/post_type/custom_field_list', $fields['children']['custom_fields']['fields'], $this->post_type); |
| 160 | - $fields = apply_filters('iwp/exporter/post_type/fields', $fields, $this->post_type); | |
| 160 | + $fields = apply_filters('iwp/exporter/post_type/fields', $fields, $this->get_post_types_array()); | |
| 161 | 161 | |
| 162 | 162 | if (in_array('attachment', $post_types)) { |
| 163 | 163 | $fields['fields'][] = 'url'; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - return $fields; | |
| 166 | + return $this->parse_fields($fields); | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |
| 170 | 170 | public function have_records($exporter_id) |
| @@ -214,31 +214,33 @@ | ||
| 214 | 214 | case 'post_thumbnail': |
| 215 | 215 | $value = wp_get_attachment_url(get_post_thumbnail_id($record['ID'])); |
| 216 | 216 | break; |
| 217 | 217 | case 'image': |
| 218 | + | |
| 219 | + $value = [ | |
| 220 | + 'id' => '', | |
| 221 | + 'url' => '', | |
| 222 | + 'title' => '', | |
| 223 | + 'alt' => '', | |
| 224 | + 'caption' => '', | |
| 225 | + 'description' => '' | |
| 226 | + ]; | |
| 227 | + | |
| 218 | 228 | $thumbnail_id = intval(get_post_thumbnail_id($record['ID'])); |
| 219 | 229 | if ($thumbnail_id > 0) { |
| 220 | - | |
| 221 | 230 | $attachment = get_post($thumbnail_id, ARRAY_A); |
| 222 | - $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); | |
| 231 | + if ($attachment) { | |
| 223 | 232 | |
| 224 | - $value = [ | |
| 225 | - 'id' => $thumbnail_id, | |
| 226 | - 'url' => wp_get_attachment_url($thumbnail_id), | |
| 227 | - 'title' => $attachment['post_title'], | |
| 228 | - 'alt' => $alt, | |
| 229 | - 'caption' => $attachment['post_excerpt'], | |
| 230 | - 'description' => $attachment['post_content'] | |
| 231 | - ]; | |
| 232 | - } else { | |
| 233 | - $value = [ | |
| 234 | - 'id' => '', | |
| 235 | - 'url' => '', | |
| 236 | - 'title' => '', | |
| 237 | - 'alt' => '', | |
| 238 | - 'caption' => '', | |
| 239 | - 'description' => '' | |
| 240 | - ]; | |
| 233 | + $alt = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true); | |
| 234 | + $value = [ | |
| 235 | + 'id' => $thumbnail_id, | |
| 236 | + 'url' => wp_get_attachment_url($thumbnail_id), | |
| 237 | + 'title' => $attachment['post_title'], | |
| 238 | + 'alt' => $alt, | |
| 239 | + 'caption' => $attachment['post_excerpt'], | |
| 240 | + 'description' => $attachment['post_content'] | |
| 241 | + ]; | |
| 242 | + } | |
| 241 | 243 | } |
| 242 | 244 | break; |
| 243 | 245 | case 'custom_fields': |
| 244 | 246 | $value = get_post_meta($record['ID']); |