Hướng dẫn tạo trang chuyển link cho wp

  • Thread starter Thread starter AdminAdmin is verified member.
  • Start date Start date
Admin

AdminAdmin is verified member.

Well-Known Member
Staff member
Administrator
Bạn có thể làm theo các bước sau mà không cần dùng Plugin gì cả:


1. Replace hết các link trong bài viết thành http://domain.com/go.php?u=<link gốc>


Bạn thêm vào file function.php của theme đoạn sau:


PHP:
function tuoitrevn_filter_content($content) {
    $new_content = str_replace('href="', 'href="http://domain.com/go.php?u=', $content);
    return $new_content;
}
add_filter('the_content', 'tuoitrevn_filter_content');


2. Tạo 1 file go.php ở thư mục gốc cài đặt wp với nội dung sau:


PHP:
<html><head></head><body><center><?php $gourl = $_GET['u']; ?><iframe name="cwindow" style="border: 0pt none;" src="<?php echo $gourl; ?>" rel="nofollow" height="100%" scrolling="AUTO" width="100%"></iframe></center></body></html>

Trong file go.php này bạn muốn trình bày gì thêm cũng được.
Xong
 

Facebook Comments

Similar threads

Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
3K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
G
Replies
2
Views
3K
namkyland
N
djdungcuty
Replies
0
Views
9K
djdungcuty
djdungcuty
Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Admin
Replies
0
Views
1K
AdminAdmin is verified member.
Admin
Back
Top