رفتن به مطلب

افزونه iframe لینکهای خروجی


پست های پیشنهاد شده

سلام خسته نباشید

افزونه ای میخاستم که لینکهای خروجی سایتم رو به آدرس داخلی تبدیل کنه و تو single.php منتقل بشه وقتی رو لینک کلید شد و صفحه اون وب رو بصورت iframe در single.php خودم (وبسایت خودم) داشته باشم.

لطفا راهنمایی کنید یا راه حلی . . .

پیشاپیش تشکر

لینک به ارسال

سلام

iframe رو بزارید و مقدار target تمام لینک ها رو نام iframe بزارید درست میشه. برای اضافه کردن target به تمام لینک ها دستور زیر رو می تونید استفاده کنید:


$("a[href^='http://']").attr("target","my frame");

لینک به ارسال

شما نظر بنده رو متوجه نشدید !!!

ببین من یک آدرس در index گذاشتم که آدرس وبسایت دیگری است میخاهم اول ازین که این آدرس داخلی سازی شده باشه ینی زیر مجموعه لینکای خودم بشه بنحوی همون انتقال لینک !

و دوم اینکه وقتی بر روی لینک کلیک شد به جای فالو کردن آدرس به مسیر اصلی همانند یک پست در single.php من باز بشه و صفحه اون سایت که لینکش رو گذاشتم بصورت iframe باشه !

بنحوی مشابه خبر خوان ها

تخصص هم متوسط به بالا

ویرایش شده توسط farid44
لینک به ارسال

نه دوست عزیز !!

آقا اصن همین اسکریپت انتقال لینک همچین چیزی مد نظرمه وای نمیدونم چرا کسی متجه نمیشه !!

یه کد افزونه اسکریپت یا هرچی که وقتی رو یه سری لینکای خارجی کلیک میکنی منتقل بشن به ادرس خودت همون کار :


$_GET["url"];

لطفا راهنمایی کنید

لینک به ارسال
وای نمیدونم چرا کسی متجه نمیشه

همیشه اگر چیزی گفتید که هیچ کس متوجه نشد مطمئن باشید یا شما نمی توانید درست منظورتان را بیان کنید یا متوجه پاسخ درست نشدید

پاسخ هاتون همه صحیح بودند و پاسخ جناب عبدالماجد هم آموزش دقیق اینکاریست که می خواهید انجام بشه

لینک به ارسال
  • 3 ماه بعد...

با عرض سلام و خسته نباشید

من هم مشابه همین کار رو میخوام انجام بدم ولی متاسفانه جواب جناب مهدوی رو متوجه نشدم.

من با افزونه rss aggregator فیدهای سایت های دیگر رو میخوام نشون بدم.ولی میخوام وقتی رو لینکی کلیک کردن به صورت iframe بره تو اون سایت.(مثل کاری که بعضی از سایت های خبری می کنن(مثل tnews.ir))

ممنون میشم راهنماییم کنید.

با تشکر

لینک به ارسال

اینم کد قسمت نمایش فیید افزونه:


<?php
/**
* Feed display related functions
*
* @package WPRSSAggregator
*/

add_filter( 'the_content', 'wprss_render_feed_view' );
/**
* Display template for a feed source. Simulates a shortcode call.
*
* @since 4.6.6
*/
function wprss_render_feed_view( $content ) {
if ( get_post_type() === 'wprss_feed' && ! is_feed() ) {
$content = wprss_shortcode( array(
'source' => get_the_ID()
) );
}
return $content;
}

add_filter( 'the_content', 'wprss_render_feed_item_view' );
/**
* Display template for a feed source. Simulates a shortcode call.
*
* @since 4.6.6
*/
function wprss_render_feed_item_view( $content ) {
if ( get_post_type() === 'wprss_feed_item' && ! is_feed() ) {
$content = wprss_shortcode_single( array(
'id' => get_the_ID()
) );
}
return $content;
}

/**
* Renders a single feed item.
*
* @param int $ID The ID of the feed item to render
* @param string $default The default text to return if something fails.
* @return string The output
* @since 4.6.6
*/
function wprss_render_feed_item( $ID = NULL, $default = '', $args = array() ) {
$ID = ( $ID === NULL )? get_the_ID() : $ID;
if ( get_post_type( $ID ) !== 'wprss_feed_item' || is_feed() ) return $default;
// Prepare the options
$general_settings = get_option( 'wprss_settings_general' );
$display_settings = wprss_get_display_settings( $general_settings );
$excerpts_settings = get_option( 'wprss_settings_excerpts' );
$thumbnails_settings = get_option( 'wprss_settings_thumbnails' );
$extra_options = apply_filters( 'wprss_template_extra_options', array(), $args);
// Normalize the source_link option
$source_link = isset( $general_settings['source_link'] )? $general_settings['source_link'] : 0;
// Declare each item in $args as its own variable
extract( $args, EXTR_SKIP );
// Get the item meta
$permalink = get_post_meta( $ID, 'wprss_item_permalink', true );
$enclosure = get_post_meta( $ID, 'wprss_item_enclosure', true );
$feed_source_id = get_post_meta( $ID, 'wprss_feed_id', true );
$link_enclosure = get_post_meta( $feed_source_id, 'wprss_enclosure', true );
$source_name = get_the_title( $feed_source_id );
$source_url = get_post_meta( $feed_source_id, 'wprss_site_url', true );
$timestamp = get_the_time( 'U', $ID );
// Fallback for feeds created with older versions of the plugin
if ( $source_url === '' ) $source_url = get_post_meta( $feed_source_id, 'wprss_url', true );
// convert from Unix timestamp
$date = wprss_date_i18n( $timestamp );
// Prepare the title
$feed_item_title = get_the_title();
$feed_item_title_link = ( $link_enclosure === 'true' && $enclosure !== '' )? $enclosure : $permalink;
// Prepare the text that precedes the source
$text_preceding_source = wprss_get_general_setting('text_preceding_source');
$text_preceding_source = ltrim( __( $text_preceding_source, WPRSS_TEXT_DOMAIN ) . ' ' );
$text_preceding_date = wprss_get_general_setting('text_preceding_date');
$text_preceding_date = ltrim( __( $text_preceding_date, WPRSS_TEXT_DOMAIN ) . ' ' );

do_action( 'wprss_get_post_data' );

$meta = $extra_options;
$extra_meta = apply_filters( 'wprss_template_extra_meta', $meta, $args, $ID );
///////////////////////////////////////////////////////////////
// BEGIN TEMPLATE
// Prepare the output
$output = '';
// Begin output buffering
ob_start();
// Print the links before
echo $link_before;
// The Title
$item_title = wprss_link_display( $feed_item_title_link, $feed_item_title, wprss_get_general_setting('title_link') );
$item_title = apply_filters('wprss_item_title', $item_title, $feed_item_title_link, $feed_item_title, wprss_get_general_setting('title_link'));
echo $item_title;
do_action( 'wprss_after_feed_item_title', $extra_meta, $display_settings, $ID );

// FEED ITEM META
echo '<div class="wprss-feed-meta">';
// SOURCE
if ( wprss_get_general_setting('source_enable') == 1 ) {
echo '<span class="feed-source">';
$source_link_text = apply_filters('wprss_item_source_link', wprss_link_display( $source_url, $source_name, $source_link ) );
$source_link_text = $text_preceding_source . $source_link_text;
echo $source_link_text;
echo '</span>';
}
// DATE
if ( wprss_get_general_setting('date_enable') == 1 ) {
echo '<span class="feed-date">';
$date_text = apply_filters( 'wprss_item_date', $date );
$date_text = $text_preceding_date . $date_text;
echo $date_text;
echo '</span>';
}
// AUTHOR
$author = get_post_meta( $ID, 'wprss_item_author', TRUE );
if ( wprss_get_general_setting('authors_enable') == 1 && $author !== NULL && is_string( $author ) && $author !== '' ) {
echo '<span class="feed-author">';
$author_text = apply_filters( 'wprss_item_author', $author );
$author_prefix_text = apply_filters( 'wprss_author_prefix_text', 'By' );
_e( $author_prefix_text, WPRSS_TEXT_DOMAIN );
echo ' ' . $author_text;
echo '</span>';
}

echo '</div>';
// TIME AGO
if ( wprss_get_general_setting('date_enable') == 1 && wprss_get_general_setting('time_ago_format_enable') == 1 ) {
$time_ago = human_time_diff( $timestamp, time() );
echo '<div class="wprss-time-ago">';
$time_ago_text = apply_filters( 'wprss_item_time_ago', $time_ago );
printf( __( '%1$s پیش', WPRSS_TEXT_DOMAIN ), $time_ago_text );
echo '</div>';
}
// END TEMPLATE - Retrieve buffered output
$output .= ob_get_clean();
$output = apply_filters( 'wprss_single_feed_output', $output, $permalink );
$output .= "$link_after";
// Print the output
return $output;
}

/**
* Retrieve settings and prepare them for use in the display function
*
* @since 3.0
*/
function wprss_get_display_settings( $settings = NULL ) {
if ( $settings === NULL ) {
$settings = get_option( 'wprss_settings_general' );
}
// Parse the arguments together with their default values
$args = wp_parse_args(
$settings,
array(
'open_dd' => 'New Window',
'follow_dd' => '',
)
);
// Prepare the 'open' setting - how to open links for feed items
$open = '';
switch ( $args['open_dd'] ) {
case 'Lightbox' :
$open = 'class="colorbox"';
break;
case 'New window' :
$open = 'target="_blank"';
break;
}
// Prepare the 'follow' setting - whether links marked as nofollow or not
$follow = ( $args['follow_dd'] == 'no_follow' )? 'rel="nofollow"' : '';
// Prepare the final settings array
$display_settings = array(
'open' => $open,
'follow' => $follow
);
do_action( 'wprss_get_settings' );
return $display_settings;
}

/**
* Merges the default arguments with the user set arguments
*
* @since 3.0
*/
function wprss_get_shortcode_default_args( $args ) {
// Default shortcode/function arguments for displaying feed items
$shortcode_args = apply_filters(
'wprss_shortcode_args',
array(
'links_before' => '<ul class="rss-aggregator">',
'links_after' => '</ul>',
'link_before' => '<li class="feed-item">',
'link_after' => '</li>'
)
);
// Parse incoming $args into an array and merge it with $shortcode_args
$args = wp_parse_args( $args, $shortcode_args );
return $args;
}

/**
* Prepares and builds the query for fetching the feed items
*
* @since 3.0
*/
function wprss_get_feed_items_query( $settings ) {
if( isset( $settings['feed_limit'] ) ) {
$posts_per_page = $settings['feed_limit'];
} else {
$posts_per_page = wprss_get_general_setting('feed_limit');
}
global $paged;
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} elseif ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}

$feed_items_args = array(
'post_type' => 'wprss_feed_item',
'posts_per_page' => $posts_per_page,
'orderby' => 'date',
'order' => 'DESC',
'paged' => $paged,
'suppress_filters' => true
);
if ( isset($settings['pagination']) ) {
$pagination = strtolower( $settings['pagination'] );
if ( in_array( $pagination, array('false','off','0') ) ) {
unset( $feed_items_args['paged'] );
}
}
if ( isset( $settings['no-paged'] ) && $settings['no-paged'] === TRUE ) {
unset( $feed_items_args['no-paged'] );
}

// If either the source or exclude arguments are set (but not both), prepare a meta query
if ( isset( $settings['source'] ) xor isset( $settings['exclude'] ) ) {
// Set the appropriate setting and operator
$setting = 'source';
$operator = 'IN';
if ( isset( $settings['exclude'] ) ) {
$setting = 'exclude';
$operator = 'NOT IN';
}
$feeds = array_filter( array_map( 'intval', explode( ',', $settings[$setting] ) ) );
foreach ( $feeds as $feed )
trim( $feed );
if ( !empty( $feeds ) ) {
$feed_items_args['meta_query'] = array(
array(
'key' => 'wprss_feed_id',
'value' => $feeds,
'type' => 'numeric',
'compare' => $operator,
),
);
}
}
// Arguments for the next query to fetch all feed items
$feed_items_args = apply_filters( 'wprss_display_feed_items_query', $feed_items_args, $settings );
// Query to get all feed items for display
$feed_items = new WP_Query( $feed_items_args );
if ( isset( $settings['get-args'] ) && $settings['get-args'] === TRUE ) {
return $feed_items_args;
} else return $feed_items;
}

add_action( 'wprss_display_template', 'wprss_default_display_template', 10, 3 );
/**
* Default template for feed items display
*
* @since 3.0
* @param $args array The shortcode arguments
* @param $feed_items WP_Query The feed items to display
*/
function wprss_default_display_template( $args, $feed_items ) {
global $wp_query;
global $paged;
// Swap the current WordPress Query with our own
$old_wp_query = $wp_query;
$wp_query = $feed_items;
// Prepare the output
$output = '';
// Check if our current query returned any feed items
if ( $feed_items->have_posts() ) {
// PRINT LINKS BEFORE LIST OF FEED ITEMS
$output .= $args['links_before'];
// FOR EACH ITEM
while ( $feed_items->have_posts() ) {
// Get the item
$feed_items->the_post();
// Add the output
$output .= wprss_render_feed_item( NULL, '', $args );
}
// OUTPUT LINKS AFTER LIST OF FEED ITEMS
$output .= $args['links_after'];
// Add pagination if needed
if ( !isset( $args['pagination'] ) || !in_array( $args['pagination'], array('off','false','0',0) ) ) {
$output = apply_filters( 'wprss_pagination', $output );
}
// Filter the final output, and print it
echo apply_filters( 'feed_output', $output );
} else {
// No items found message
echo apply_filters( 'no_feed_items_found', __( 'No feed items found.', WPRSS_TEXT_DOMAIN ) );
}
// Reset the WordPress query
$wp_query = $old_wp_query;
wp_reset_postdata();
}

/**
* Generates an HTML link, using the saved display settings.
*
* @param string $link The link URL
* @param string $text The link text to display
* @param string $bool Optional boolean. If FALSE, the text is returned unlinked. Default: TRUE.
* @return string The generated link
* @since 4.2.4
*/
function wprss_link_display( $link, $text, $bool = TRUE ) {
$display_settings = wprss_get_display_settings( get_option( 'wprss_settings_general' ) );
$a = $bool ? "<a {$display_settings['open']} {$display_settings['follow']} href='$link'>$text</a>" : $text;
return $a;
}

add_filter( 'wprss_pagination', 'wprss_pagination_links' );
/**
* Display pagination links
*
* @since 3.5
*/
function wprss_pagination_links( $output ) {
// Get the general setting
$pagination = wprss_get_general_setting( 'pagination' );;

// Check the pagination setting, if using page numbers
if ( $pagination === 'numbered' ) {
global $wp_query;
$big = 999999999; // need an unlikely integer
$output .= paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
) );
return $output;
}
// Otherwise, using default paginations
else {
$output .= '<div class="nav-links">';
$output .= ' <div class="nav-previous alignleft">' . get_next_posts_link( __( 'مطالب قدیمی‌تر', WPRSS_TEXT_DOMAIN ) ) . '</div>';
$output .= ' <div class="nav-next alignright">' . get_previous_posts_link( __( 'مطالب جدیدتر', WPRSS_TEXT_DOMAIN ) ) . '</div>';
$output .= '</div>';
return $output;
}
}

add_filter( 'the_title', 'wprss_shorten_title', 10, 2 );
/**
* Checks the title limit option and shortens the title when necassary.
*
* @since 1.0
*/
function wprss_shorten_title( $title, $id = null ) {
if ( $id === null ) return $title;
// Get the option. If does not exist, use 0, which is ignored.
$general_settings = get_option( 'wprss_settings_general' );
$title_limit = isset( $general_settings['title_limit'] )? intval( $general_settings['title_limit'] ) : 0;
// Check if the title is for a wprss_feed_item, and check if trimming is needed
if ( isset( $id ) && get_post_type( $id ) === 'wprss_feed_item' && $title_limit > 0 && strlen( $title ) > $title_limit ) {
// Return the trimmed version of the title
return substr( $title, 0, $title_limit ) . apply_filters( 'wprss_shortened_title_ending', '...' );
}
// Otherwise, return the same title
return $title;
}

/**
* Display feed items on the front end (via shortcode or function)
*
* @since 2.0
*/
function wprss_display_feed_items( $args = array() ) {
$settings = get_option( 'wprss_settings_general' );
$args = wprss_get_shortcode_default_args( $args );
$args = apply_filters( 'wprss_shortcode_args', $args );
$query_args = $settings;
if ( isset( $args['limit'] ) ) {
$query_args['feed_limit'] = filter_var( $args['limit'], FILTER_VALIDATE_INT, array(
'options' => array(
'min_range' => 1,
'default' => $query_args['feed_limit'],
),
) );
}
if ( isset( $args['pagination'] ) ) {
$query_args['pagination'] = $args['pagination'];
}
if ( isset( $args['source'] ) ) {
$query_args['source'] = $args['source'];
}
elseif ( isset( $args['exclude'] ) ) {
$query_args['exclude'] = $args['exclude'];
}
$query_args = apply_filters( 'wprss_process_shortcode_args', $query_args, $args );
$feed_items = wprss_get_feed_items_query( $query_args );
do_action( 'wprss_display_template', $args, $feed_items );
}

/**
* Redirects to wprss_display_feed_items
* It is used for backwards compatibility to versions < 2.0
*
* @since 2.1
*/
function wp_rss_aggregator( $args = array() ) {
wprss_display_feed_items( $args );
}

/**
* Limits a phrase/content to a defined number of words
*
* NOT BEING USED as we're using the native WP function, although the native one strips tags, so I'll
* probably revisit this one again soon.
*
* @since 3.0
* @param string $words
* @param integer $limit
* @param string $append
* @return string
*/
function wprss_limit_words( $words, $limit, $append = '' ) {
/* Add 1 to the specified limit becuase arrays start at 0 */
$limit = $limit + 1;
/* Store each individual word as an array element
up to the limit */
$words = explode( ' ', $words, $limit );
/* Shorten the array by 1 because that final element will be the sum of all the words after the limit */
array_pop( $words );
/* Implode the array for output, and append an ellipse */
$words = implode( ' ', $words ) . $append;
/* Return the result */
return rtrim( $words );
}

یه سوال دیگم داشتم:

چطور میتونم اندازه فونت و رنگ لینک ها رو تغییر بدم.(نمی خوام تنظیمات کل لینک های سایت تغییر کنن..فقط میخوام لینک های قسمت فیدها رو تغییر بدم.)

بازم ممنون

لینک به ارسال
  • 2 ماه بعد...

برای اینکه سایت جدید با آدرس سایت شما باز بشه میتونید از افزونه MyLinksDump استفاده کنید. برای آی فریم شدنش هم که دوستان توضیح دادند.

لینک به ارسال
  • 2 ماه بعد...

سلام و خسته نباشید

چجوری میتونم همه لینک های خروجی سایتم رو بصورت اتوماتیک در ای فریم باز کنم؟

لینک به ارسال

به گفتگو بپیوندید

هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .

مهمان
ارسال پاسخ به این موضوع ...

×   شما در حال چسباندن محتوایی با قالب بندی هستید.   حذف قالب بندی

  تنها استفاده از 75 اموجی مجاز می باشد.

×   لینک شما به صورت اتوماتیک جای گذاری شد.   نمایش به صورت لینک

×   محتوای قبلی شما بازگردانی شد.   پاک کردن محتوای ویرایشگر

×   شما مستقیما نمی توانید تصویر خود را قرار دهید. یا آن را اینجا بارگذاری کنید یا از یک URL قرار دهید.

×
×
  • اضافه کردن...