From f193617b86aaf619631464a999393e5a42d6ebb3 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 1 Aug 2024 11:54:53 +0530 Subject: [PATCH 1/3] Add new fillter for item_url --- includes/admin/feedzy-rss-feeds-import.php | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-import.php b/includes/admin/feedzy-rss-feeds-import.php index 3784e2e4..0e7613d0 100644 --- a/includes/admin/feedzy-rss-feeds-import.php +++ b/includes/admin/feedzy-rss-feeds-import.php @@ -1470,7 +1470,30 @@ private function run_job( $job, $max ) { $item_link_txt = apply_filters( 'feedzy_invoke_auto_translate_services', $item_link_txt, '[#item_url]', $import_translation_lang, $job, $language_code, $item ); } - $item_link = '' . $item_link_txt . ''; + $item_link_data = apply_filters( + 'feedzy_item_link', + array( + 'text' => $item_link_txt, + 'attr' => array( + 'href' => $item['item_url'], + 'target' => '_blank', + 'class' => 'feedzy-rss-link-icon', + ), + ), + $item, + $job + ); + $item_link_attr = isset( $item_link_data['attr'] ) ? $item_link_data['attr'] : array(); + $item_link_attr = array_map( + function ( $attr, $key ) { + return sprintf( '%1$s="%2$s"', $key, esc_attr( $attr ) ); + }, + $item_link_attr, + array_keys( $item_link_attr ) + ); + + $item_link_txt = isset( $item_link_data['text'] ) ? $item_link_data['text'] : $item_link_txt; + $item_link = '' . $item_link_txt . ''; // Rewriter item title from feedzy API. if ( $rewrite_service_endabled && false !== strpos( $post_title, '[#title_feedzy_rewrite]' ) ) { @@ -1478,8 +1501,6 @@ private function run_job( $job, $max ) { $post_title = str_replace( '[#title_feedzy_rewrite]', $title_feedzy_rewrite, $post_title ); } - $item_link = '' . __( 'Read More', 'feedzy-rss-feeds' ) . ''; - $image_html = ''; if ( ! empty( $item['item_img_path'] ) ) { $image_html = ''; From 37e3e0d8ec8be67b1dfbdc02c347c294d125b8ac Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 1 Aug 2024 16:27:47 +0530 Subject: [PATCH 2/3] Remove WP default rel --- includes/admin/feedzy-rss-feeds-import.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/admin/feedzy-rss-feeds-import.php b/includes/admin/feedzy-rss-feeds-import.php index 0e7613d0..3caed268 100644 --- a/includes/admin/feedzy-rss-feeds-import.php +++ b/includes/admin/feedzy-rss-feeds-import.php @@ -1483,6 +1483,12 @@ private function run_job( $job, $max ) { $item, $job ); + + // Remove WordPress default link rel. + if ( isset( $item_link_data['attr']['rel'] ) ) { + add_filter( 'wp_targeted_link_rel', '__return_null' ); + } + $item_link_attr = isset( $item_link_data['attr'] ) ? $item_link_data['attr'] : array(); $item_link_attr = array_map( function ( $attr, $key ) { From 8758af590c3fc6e088571fd60d464806f55c5ebf Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 1 Aug 2024 23:38:46 +0530 Subject: [PATCH 3/3] Override WP default link rel --- includes/admin/feedzy-rss-feeds-import.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/admin/feedzy-rss-feeds-import.php b/includes/admin/feedzy-rss-feeds-import.php index 3caed268..6c065f64 100644 --- a/includes/admin/feedzy-rss-feeds-import.php +++ b/includes/admin/feedzy-rss-feeds-import.php @@ -1485,8 +1485,14 @@ private function run_job( $job, $max ) { ); // Remove WordPress default link rel. - if ( isset( $item_link_data['attr']['rel'] ) ) { - add_filter( 'wp_targeted_link_rel', '__return_null' ); + $link_rel = isset( $item_link_data['attr']['rel'] ) ? $item_link_data['attr']['rel'] : ''; + if ( $link_rel ) { + add_filter( + 'wp_targeted_link_rel', + function() use ( $link_rel ) { + return $link_rel; + } + ); } $item_link_attr = isset( $item_link_data['attr'] ) ? $item_link_data['attr'] : array();