wodpress博客的评论外链加上跳转的方法

2016-06-02 08:21:05 163

wodpress博客的评论外链已经是许多博主不可接受的一种程度了,我们下面来给各位介绍一篇把外连通过修改成跳转的连接了,这样不会影响到网站权重了.

模板function.php添加下面的代码:

  1. /**博客的评论里的外链转内链**/ 

  2. add_filter('get_comment_author_link','add_redirect_comment_link', 5); 

  3. add_filter('comment_text''add_redirect_comment_link', 99); 

  4. function add_redirect_comment_link($text''){ 

  5.   $text=str_replace('href="','href="'.get_option('home').'/goto.php?url='$text); 

  6.   $text=str_replace("href='","href='".get_option('home')."/goto.php?url="$text); //phpfensi.com 

  7.   return$text

上面的代码其实就是把页面显示的链接都修改成http://www.landui.com/goto.php?url=【网站链接】

新建goto.php,放到跟目录下.

  1. <html lang="en"> 

  2. <head> 

  3. <meta charset="utf-8"> 

  4. <meta name="Author" content=""> 

  5. <meta name="Keywords" content=""> 

  6. <meta name="Description" content=""> 

  7. <meta name="robots"content="noindex,nofollow"> 

  8.  

  9. <meta http-equiv="refresh"content="3;url=php $url=$_GET['url']; echo htmlspecialchars($url);?>"> 

  10. <title>跳转页面title> 

  11. <style> 

  12. .spinner { 

  13. margin: 100px auto 0; 

  14. width: 150px; 

  15. text-align: center; 

  16.  

  17. .spinner > div { 

  18. width: 30px; 

  19. height: 30px; 

  20.  

  21.  

  22. border-radius: 100%; 

  23. display: inline-block; 

  24. -webkit-animation: bouncedelay 1.4s infinite ease-in-out; 

  25. animation: bouncedelay 1.4s infinite ease-in-out; 

  26. /* Prevent first frame from flickering when animation starts */ 

  27. -webkit-animation-fill-mode: both; 

  28. animation-fill-mode: both; 

  29.  

  30. .spinner .bounce1 { 

  31. -webkit-animation-delay: -0.32s; 

  32. animation-delay: -0.32s; 

  33. background-color: #428bca; 

  34.  

  35. .spinner .bounce2 { 

  36. -webkit-animation-delay: -0.16s; 

  37. animation-delay: -0.16s; 

  38. background-color: #Dd534F; 

  39.  

  40. .spinner .bounce3 { 

  41. -webkit-animation-delay: -0.01s; 

  42. animation-delay: -0.01s; 

  43. background-color: #67CF22; 

  44.  

  45. @-webkit-keyframes bouncedelay { 

  46. 0%, 80%, 100% { -webkit-transform: scale(0.0) } 

  47. 40% { -webkit-transform: scale(1.0) } 

  48.  

  49. @keyframes bouncedelay { 

  50. 0%, 80%, 100% { 

  51. transform: scale(0.0); 

  52. -webkit-transform: scale(0.0); 

  53. } 40% { 

  54. transform: scale(1.0); 

  55. -webkit-transform: scale(1.0); 

  56. style> 

  57. head> 

  58. <body> 

  59. <div class="spinner"> 

  60. <div class="bounce1">div> 

  61. <div class="bounce2">div> 

  62. <div class="bounce3">div> 

  63. div> 

  64. body> 

  65. html> 


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题:
XML 地图