Add the redirection method to the comment outer link of the wodpress blog

Source: Internet
Author: User
Tags comments goto php file php template

Yesterday, I modified the external links in my blog's comments, and changed the external links to the internal links. I threw myself into my blog and checked whether the results were good. I would like to share them below.

Add the following code to the function. php template:

/** External links to internal links in blog comments **/
Add_filter ('Get _ comment_author_link ', 'Add _ redirect_comment_link', 5 );
Add_filter ('comment _ text', 'Add _ redirect_comment_link ', 99 );
Function add_redirect_comment_link ($ text = ''){
$ Text = str_replace ('href = "', 'href ="'. get_option ('Home'). '/goto. php? Url = ', $ text );
$ Text = str_replace ("href = '", "href ='". get_option ('Home'). "/goto. php? Url = ", $ text );
Return $ text;
}

The above code is actually the page display link are modified to http://www.111cn.net/goto. php? Url = [Website Link]
Create a new goto. php file and put it in the directory with the same name.

<! Doctype html>
<Html lang = "en">
<Head>
<Meta charset = "UTF-8">
<Meta name = "Author" content = "">
<Meta name = "Keywords" content = "">
<Meta name = "Description" content = "">
<Meta name = "robots" content = "noindex, nofollow">
 
<Meta http-equiv = "refresh" content = "3; url = <? Php $ url = $ _ GET ['URL']; echo htmlspecialchars ($ url);?> ">
<Title> Jump page </title>
<Style>
. Spinner {
Margin: 100px auto 0;
Width: 150px;
Text-align: center;
}
 
. Spinner> div {
Width: 30px;
Height: 30px;
 
 
Border-radius: 100%;
Display: inline-block;
-Webkit-animation: bouncedelay 1.4 s infinite embedded-in-out;
Animation: bouncedelay 1.4 s infinite injection-in-out;
/* Prevent first frame from flickering when animation starts */
-Webkit-animation-fill-mode: both;
Animation-fill-mode: both;
}
 
. Spinner. bounce1 {
-Webkit-animation-delay:-0.32 s;
Animation-delay:-0.32 s;
Background-color: # 428bca;
}
 
. Spinner. bounce2 {
-Webkit-animation-delay:-0.16 s;
Animation-delay:-0.16 s;
Background-color: # Dd534F;
}
 
. Spinner. Bounc4 {
-Webkit-animation-delay:-0.01 s;
Animation-delay:-0.01 s;
Background-color: #67CF22;
}
 
@-Webkit-keyframes bouncedelay {
0%, 80%, 100% {-webkit-transform: scale (0.0 )}
40% {-webkit-transform: scale (1.0 )}
}
 
@ Keyframes bouncedelay {
0%, 80%, 100% {
Transform: scale (1, 0.0 );
-Webkit-transform: scale (0.0 );
} 40% {
Transform: scale (1, 1.0 );
-Webkit-transform: scale (1.0 );
}
}
</Style>
</Head>
<Body>
<Div class = "spinner">
<Div class = "bounce1"> </div>
<Div class = "bounce2"> </div>
<Div class = "boune3"> </div>
</Div>
</Body>
</Html>

Okay. Leave a message if you have any questions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.