From f193617b86aaf619631464a999393e5a42d6ebb3 Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Thu, 1 Aug 2024 11:54:53 +0530 Subject: [PATCH] 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 = '';