Skip to content

Commit

Permalink
Fix import custom value when using #item_full_content shortcode Codei…
Browse files Browse the repository at this point in the history
  • Loading branch information
girishpanchal30 committed Jun 30, 2021
1 parent 43be60b commit f305d76
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions includes/admin/feedzy-rss-feeds-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -1190,8 +1190,13 @@ private function run_job( $job, $max ) {

// the array that captures additional information about the import.
$import_info = array();

$results = $this->get_job_feed( $options, $import_content, true );

$xml_results = '';
if ( '[#item_full_content]' === $import_content ) {
$xml_results = $this->get_job_feed( $options, '[#item_content]', true );
}

if ( is_wp_error( $results ) ) {
$import_errors[] = $results->get_error_message();
update_post_meta( $job->ID, 'import_errors', $import_errors );
Expand Down Expand Up @@ -1283,7 +1288,7 @@ private function run_job( $job, $max ) {
);

if ( $this->feedzy_is_business() ) {
$post_title = apply_filters( 'feedzy_parse_custom_tags', $post_title, $results['feed'], $item['item_index'] );
$post_title = apply_filters( 'feedzy_parse_custom_tags', $post_title, ! empty( $xml_results ) ? $xml_results['feed'] : $results['feed'], $item['item_index'] );
}

$post_title = apply_filters( 'feedzy_invoke_services', $post_title, 'title', $item['item_title'], $job );
Expand Down Expand Up @@ -1340,7 +1345,7 @@ private function run_job( $job, $max ) {
}

if ( $this->feedzy_is_business() ) {
$post_content = apply_filters( 'feedzy_parse_custom_tags', $post_content, $results['feed'], $item['item_index'] );
$post_content = apply_filters( 'feedzy_parse_custom_tags', $post_content, ! empty( $xml_results ) ? $xml_results['feed'] : $results['feed'], $item['item_index'] );
}

$post_content = apply_filters( 'feedzy_invoke_services', $post_content, 'content', $item['item_description'], $job );
Expand Down Expand Up @@ -1429,7 +1434,7 @@ private function run_job( $job, $max ) {
}
}

do_action( 'feedzy_import_extra', $job, $results, $new_post_id, $index, $item['item_index'], $import_errors, $import_info );
do_action( 'feedzy_import_extra', $job, ! empty( $xml_results ) ? $xml_results : $results, $new_post_id, $index, $item['item_index'], $import_errors, $import_info );

if ( ! empty( $import_featured_img ) ) {
$image_url = '';
Expand All @@ -1445,7 +1450,7 @@ private function run_job( $job, $max ) {
}
} elseif ( strpos( $import_featured_img, '[#item_custom' ) !== false ) {
// custom image tag
$value = apply_filters( 'feedzy_parse_custom_tags', $import_featured_img, $results['feed'], $index );
$value = apply_filters( 'feedzy_parse_custom_tags', $import_featured_img, ! empty( $xml_results ) ? $xml_results['feed'] : $results['feed'], $index );
if ( ! empty( $value ) && strpos( $value, '[#item_custom' ) === false ) {
$image_url = $value;
} else {
Expand Down

0 comments on commit f305d76

Please sign in to comment.